Anubhav Posted October 11, 2014 Share Posted October 11, 2014 if x ~= "x" then if not tonumber(tostring(x)) then return outputChatBox("*X value must be in number!", client, 255, 0, 0) end executeSQLQuery( "UPDATE teleportData SET x=? WHERE command=?", tonumber(tostring(x)), oc ) end This is my piece of a code. See here, x is the value of guiGetText ( i triggered. ) Ok so the problem starts My x's test it x still it goes infront and returns *X value must be in number! What's wrong? Link to comment
darhal Posted October 11, 2014 Share Posted October 11, 2014 Use if type(x) == 'number' then outputChatBox('X must be number') return end Link to comment
Saml1er Posted October 11, 2014 Share Posted October 11, 2014 Btw there's no need to use tostring when calling tonumber. print ( type ( tonumber ( tostring ('"6"') ) ) ) --> nil print ( type ( tonumber ('"6"' ) ) ) --> nil So it's pointless because you get the same result. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now