Hello,
How do I fix this error?
Hello,
How do I fix this error?
.
is a string pattern for all characters. Programming in Lua : 20.2
Escape it by doing %.
local str = "4"
if string.match(str, "%.") then
print("aa")
end
If you’re trying to check if a number is an integer, given that the variable is already casted to a number, you can do:
if x % 1 == 0 then
print("im an integer")
end
since someone replied with an answer, here is a link to show you how string patterns work
% is used to escape special characters