Run Code  | API  | Code Wall  | Users  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

help with lua number input


            
                
            
 run  | edit  | history  | help 0

Let me explain, if the user inputs "13" the value of amount wont be a number, it will be a string, example:

User inputs "18" Value of "amount": "18" (not a number)

So, instead, you should do this

io.write("enter a number  ")
amount = io.read()

isNumber = tonumber(amount)
if not isNumber then 
  print("no amount selected")
end
  by  LuaExperimentator, 1 months ago




Please log in to post a comment.
dd