How do I check to see a variables data type?

I am not sure how to check if user input certain data type.

I have a text field, but I need it to be numeric and have a decimal point.

I tried decimal input type but rather than giving me a numeric keyboard with a decimal point button I get a chars keyboard.

So here is what I am trying to do.

if (textField == " ") or (textField == string) do something else do something else end

but Im not sure how to check data types. 

isString(yourVariableNameGoesHere)

Also see : http://www.lua.org/manual/5.1/manual.html#pdf-tonumber

you can use tonumber() and tostring() functions to convert variables of one type to another.

http://www.lua.org/pil/2.html

try adding this to your editting phase

it wont give you the decimal inputType but

it will limit input to just numbers and ‘.’

 if type(tonumber(event.newCharacters)) == nil or (event.newCharacters ~= ".") then     event.text = string.sub(event.text, 1, #event.text-1)  end

Can’t you just do:

 if type(myInputVariable) == “number” then

   – yep it’s a number

end

Or am I missing some further need?

isString(yourVariableNameGoesHere)

Also see : http://www.lua.org/manual/5.1/manual.html#pdf-tonumber

you can use tonumber() and tostring() functions to convert variables of one type to another.

http://www.lua.org/pil/2.html

try adding this to your editting phase

it wont give you the decimal inputType but

it will limit input to just numbers and ‘.’

 if type(tonumber(event.newCharacters)) == nil or (event.newCharacters ~= ".") then     event.text = string.sub(event.text, 1, #event.text-1)  end

Can’t you just do:

 if type(myInputVariable) == “number” then

   – yep it’s a number

end

Or am I missing some further need?

that last entry was immensely helpful for a problem I was having. thanks, Rob!

that last entry was immensely helpful for a problem I was having. thanks, Rob!