• Hi All,
    Im Tring to make a simple Lua to get multiple input to use then in the Lua but i have some problem.

    function BOX()

    local options = {

    title="LEST GOOOO", --string

    backColor="Global.Focus", --string: Color based on current theme.

    messageTextColor=nil, --int|string

    message="Please \nSet \nThe Value", --string

    display= nil, --int? | handle?


    {name="Numero", value="", blackFilter="", whiteFilter="0123456789", vkPlugin="TextInputNumOnly", maxTextLength = 6},



    local Ciao = MessageBox(options)

    local messageBoxResult = MessageBox(messageBoxOptions);

    prova = string.gsub(messageBoxResult["inputs"][Numero],v , "")


    return BOX

    Anyone can help me with the structure?

  • Looks like you had some variable confusion.

    You were Calling MessageBox() twice, once with options and again with messageBoxOptions. You were using the result of the call with the nil options so I assume the result was nil as well.

    So All I did was use MessageBox(options) and print out it's result.

    Not sure what you were using gsub for since v is nil.

    Also Looks like the resulting value has been cleaned up in 1.5

    so I should really update the wiki, but a lot looks like it has changed and I haven't had a moment.

  • Hi Hoss, thank you for your answer, so if i want set that "input" to a var for later use in the plugin how i should do?

    Do i need to declare if is string or number or else?

    With the TextInput not problem i make it work but i wish have one popup for collect different value to save it in var and use it in the plugin.

  • messageBoxResult["inputs"]["Numero"] is a variable so you can either use it directly or set it to another variable local result = messageBoxResult["inputs"]["Numero"]

    It seems all the values returned from messageBox() are Strings so you can convert it using tonumber()

    local i = tonumber(messageBoxResult["inputs"]["Numero"]) -- i = numeric version of "Numero" 
    local x = tonumber("text") -- x = nil
  • No worries. just fair warning I have not updated it for 1.5, and a fair amount has changed so things might be broken or incorrect.

    Don't worry is already a lot like this,

    Do you know may why i can't make division?
    I can do all the other math but not the division.

    local count = SelectionCount()

    Printf("Selected Count: %d", count)

    local div = 2

    local half = count / div

    Printf("Selected Count: %d", half)

    Many times the half of your selection is useful to have i tried many way but not result.

  • The %d placeholder in your Printf statement expects an integer while the regular division operator "/" always creates a float.

    Try using the floor-division operator "//" instead, when you need the result to be an integer:

    local myinteger = 10
    local div = 2
    local half = myinteger / div
    local half2 =  myinteger // div

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!