Captain Cody Posted November 7, 2016 Posted November 7, 2016 (edited) is there any possible way (Other then tables or if statements) to convert strings to boolen? -- "true" -> true "false" -> false "nil" -> nil Edited November 7, 2016 by CodyL
Simple0x47 Posted November 7, 2016 Posted November 7, 2016 You could make a function like this. local _S = { "false", "nil", "true" } function convertThem( key, _type ) if ( _type == 1 ) then _S[ key ] = false elseif ( _type == 2 ) then _S[ key ] = nil elseif ( _type == 3 ) then _S[ key ] = true end end convertThem( 1, 1 ) "Keep making it simplex."
Walid Posted November 7, 2016 Posted November 7, 2016 Try this function booleanToString(boolean) return boolean and "true" or "false" end function stringToBoolean(string) return string == "true" and true or false end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
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