How do I check if an input is a number? My theory is like this:
local isNumber = tonumber(arg[1])
if isNumber then
print"This is sure a number"
else
print"This is not a number"
end
So, what you think?
arg[1]
represents a number if tonumber(arg[1])
does not return nil. So this would for example also work for a string "1"
If you want to make sure it is a number value check type(arg[1]) == "number"