I just want to know if there is a specific way of doing this.
✓ ANSWER ACCEPTED
How to check if a textbox contains a number?
1 answer
✓ Accepted answer
You can use string.match on the string to check if there's a digit/number. string.match returns something if a match is found. Otherwise, it returns nil.
if string.match(Textbox.Text, "%d") then -- %d matches a digit
-- TODO: Do something if there is a number in Textbox
end
For more info, read the wiki article for string functions and pattern matching.
This discussion is preserved as it was. New answers, comments, and votes are closed.
