MessageBox()

  • So I have been documenting the lua things I can figure out over on GitHub and ran across the amazing MessageBox(). Most of it is self explanatory but a few comments below I don't understand.


    Edited 2 times, last by hoss: Fixing comments for questions, Also need to comment out my function. ().

  • Hi hoss,


    here's my take on the unclear parts:


    Colors can be an ID reference (name or number) to the Colorgroup class (CmdlineToken: Color)

    e.g.

    '1.22'

    'Global.AlertText'

    (actual color is defined by the current ColorTheme)


    Icon can be an ID reference (name or number) to the Texture class (CmdlineToken: Texture)

    '54'

    'wizard'


    blackFilter can be used to block specific characters from entering inputfield

    e.g.

    '$()*'


    whiteFilter can be used to allow specific characters only, to enter inputfield

    e.g.

    '0123456789.'


    vkPlugin can be a named ID reference to special virtual keyboards of the Menu class (CmdlineToken: Menu)

    e.g.

    'TextInputNumOnly'


    I suspect state-grouping to be intended for radiobutton style states, but possibly not yet implemented in the GUI-engine, as there is to my knowledge no internal generic message-boxes that so far uses this.


    Be aware that the error-message echoed when passing wrong arguments is misleading,

    At the moment the option and result tables seems to require and return numerical 1/0, not Lua boolean true/false

  • Hi Both,


    i just did a copy paste to test, but i don't get a result (message box on my screen). what am i missing before i start editing all the other values?


    thanks

  • Lines 18 and 22 needed comments for questions I had.


    I just fixed the example.


    Also need to edit the last line out as it uses one of my functions.

  • Hi Hoss,


    i am creating my own messagebox now, and got pretty far. customised everything. I am only struggeling with reading out the result and putting it into a variable.

    How can i put the result "123" of input 1 into a local variable? I saw it is a table in a table in a table, and i can't readout the nested part. I checked your website and this didn't help me either.

    Code
    1. -- r[<input name>] -- the value of the input


    thanks a million

  • I should Clarify that not as it is a little confusing.


    Basically it goes like this.


    The reason I store my questions in a variable is because you need to use it twice, once to ask the question and another to get the result.


    You could also do it this way:



    The issue here is if you change the question on lines 9, 10 or 11 you need to remember to also change them on 22, 23 and 24 to receive the answers.


    Using the questions table means you define your question text once and use the table index values to receive the answers, and you can change your questions by changing one line and not two.