ListBox number/string error (Help!) [SOLVED]
Heres the scenerio. Im making a Listbox for user input. The input range is 0-9999 and everything works according to plan with this until the next step.
Im placing an if-then-else-end statement in to check that no other characters/letters are used, for the listbox to be wiped clean and a message to the user that they inputted illegal data, but im getting 'attempt to compare number with nil' error. Is there anything i can do to either allow the lua to ignore the error and carryon with the if-then-else-end statement or allow it to not do an error at all? heres the code i have at the moment- Code:
ImageAmountInput:SetWantsKeyEvents( true ); |
You could always use a function to strip out the non-numeric characters and then check if it equals that which was entered.
Lua string tutorial at; http://lua-users.org/wiki/StringLibraryTutorial |
Hehe, ive just added an if-then-end before it to check if its not tonumber( IAI ) :)
I guess the small break from staring at code gave me a little brain boost. p.s. thanks for your fast response btw MrJackdaw :D edit- Code:
ImageAmountInput:SetWantsKeyEvents( true ); |
All times are GMT -5. The time now is 08:55 AM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI