-
-
Notifications
You must be signed in to change notification settings - Fork 5
PopupInput
Anthony Headley edited this page Oct 3, 2020
·
6 revisions
PopupInput(string:title, object: display_handle, table:values...[,string:selectedValue[,integer:x,integer:y]]}) : int
Displays a Radio or Option list the user can select an item from and returns what item the user selected.
This seems to allow several types for options including strings, numbers and maybe, LUA or other display handles. more information is needed.
Name | Description | Optional |
---|---|---|
string:title | Title of the dialog box | ✔ (string or nil) |
object:displayhandel | the main display_value | |
table: value | Can be a table value of strings for each option or a table of tables in the format of {"int" | "str" | "lua" | "handle", name , type dependant}. This second methoud needs more details | |
string: selectedvalue | String of selected value | ✔ |
integer: x | X Position of Dialog | ✔ |
integer: y | Y Position of Dialog | ✔ |
nil: if user cancels
int: zero based selected value
error documentation says it returns a string:value
...
Option 1:
local function Main(display_handle,argument) -- we need this display_handle
-- ...
local title = "Select your type of pizza"
local options = {"Pineapple", "Pepperoni", "Mushroom"}
local r = PopupInput(title, display_handle, options, "Pepperoni") -- defaults to "Pepperoni", user selected "Pineapple"
Echo("result: " .. r .. " is type: " .. type(r)) -- result: 0 is type number
-- ...
end
Option 2: Needs more details
local r = PopupInput("TITLE", display_handle, {{"str", "String", nil}, {"int","Number", 123}}, "123", 1, 1)
-- displays:
-- String
-- Number <-selected
E(type(r) .. " = " .. r) -- returns the zero based number of the selected item.