generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Converting a string into a boolean?

Previous Thread :: Next Thread 
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
29 Jan 2012 01:24 PM
Let's say I have an unidentified string that can either be "true" or "false". Is there anyway I can convert the first one to true, or the second one to false depending on what they are.

{ Learning normal Lua and RBX.Lua. }
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
29 Jan 2012 01:25 PM
?*

{ Learning normal Lua and RBX.Lua. }
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
29 Jan 2012 01:27 PM
Wait..If the string can only be true or false, why not use the boolean in the first place?
Report Abuse
Alexrocksdude is not online. Alexrocksdude
Joined: 19 Jan 2011
Total Posts: 3828
29 Jan 2012 01:34 PM
@dark, Good point. Just use it for that.
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
29 Jan 2012 01:38 PM
Because I'm getting the string true or false from something a player said.

{ Learning normal Lua and RBX.Lua. }
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
29 Jan 2012 01:41 PM
Not that hard, really.

if Text:lower() == "true" then return true else return false end

^ terrible example, but oh well.

bool = Text:lower() == "true" and true or false
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image