The title explain everything.
I tried this :
local V = "145"
if (V) == "number" then
print("V is a number")
else
print("V is not a number")
end
end)
The title explain everything.
I tried this :
local V = "145"
if (V) == "number" then
print("V is a number")
else
print("V is not a number")
end
end)
You can use type() to get the type of a value.
local V = 145
if type(V) == "number" then
print("V is a number")
else
print("V is not a number")
end
worked thanks !
Np :P
You guys make no sense. Downvoting something that works? You guys have brain damage.
You can use tonumber() to check if a string can be converted to a number.
local V = "145"
if tonumber(V) then
print("V is a number")
else
print("V is not a number")
end
end)
Thanks
That's really stupid.
Use type().
tonumber is faster and requires less typing
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
I think you meant to use type or typeof ?