mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
1 line
5.0 KiB
JavaScript
1 line
5.0 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1339],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return f}});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var u=r.createContext({}),p=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(u.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,u=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),f=i,m=d["".concat(u,".").concat(f)]||d[f]||s[f]||o;return n?r.createElement(m,a(a({ref:t},c),{},{components:n})):r.createElement(m,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:i,a[1]=l;for(var p=2;p<o;p++)a[p]=n[p];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},6789:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return l},contentTitle:function(){return u},metadata:function(){return p},assets:function(){return c},toc:function(){return s},default:function(){return f}});var r=n(7462),i=n(3366),o=(n(7294),n(3905)),a=["components"],l={title:"Input Dialog"},u=void 0,p={unversionedId:"ox_lib/Client/Interface/input",id:"ox_lib/Client/Interface/input",title:"Input Dialog",description:"The input dialog window allows you to take data from the user",source:"@site/docs/ox_lib/Client/Interface/input.md",sourceDirName:"ox_lib/Client/Interface",slug:"/ox_lib/Client/Interface/input",permalink:"/docs/ox_lib/Client/Interface/input",editUrl:"https://github.com/overextended/overextended.github.io/tree/main/docs/ox_lib/Client/Interface/input.md",tags:[],version:"current",frontMatter:{title:"Input Dialog"},sidebar:"docs",previous:{title:"Update",permalink:"/docs/oxmysql/Usage/update"},next:{title:"Notifications",permalink:"/docs/ox_lib/Client/Interface/notify"}},c={},s=[{value:"lib.inputDialog",id:"libinputdialog",level:3}],d={toc:s};function f(e){var t=e.components,n=(0,i.Z)(e,a);return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The input dialog window allows you to take data from the user\nby setting input fields."),(0,o.kt)("h3",{id:"libinputdialog"},"lib.inputDialog"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-lua"},"-- heading: string\n-- rows: strings table\n\nlib.inputDialog(heading, rows)\n")),(0,o.kt)("p",null,"The callback data is promise based meaning that the thread will\nnot continue executing until the user either sends the data\nor exits the popup."),(0,o.kt)("p",null,"The data returned will be a table, indexes represent the rows\nsent to the dialog, so if we want data from the first field that\nwould be index ",(0,o.kt)("inlineCode",{parentName:"p"},"1"),", if we want data from the third field, that would\nbe index ",(0,o.kt)("inlineCode",{parentName:"p"},"3"),", etc..."),(0,o.kt)("p",null,"The input rows will always return a string, if you want a row to be of\nnumber data type, you can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"tonumber")," function to convert it to\na number instead."),(0,o.kt)("p",null,"If a user left an input field empty it will return ",(0,o.kt)("inlineCode",{parentName:"p"},"nil")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-lua"},"local input = lib.inputDialog('Police locker', {'Locker number', 'Locker passcode'})\n\nif input then\n local lockerNumber = tonumber(input[1])\n local lockerPasscode = input[2]\n\n print(lockerNumber, lockerPasscode)\nend\n")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://i.imgur.com/RvFFZqv.png",alt:"Example image"})))}f.isMDXComponent=!0}}]); |