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 » Scripters
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
03 Oct 2013 06:44 AM
Anyone else use it?
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
03 Oct 2013 06:53 AM
what
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
03 Oct 2013 06:55 AM
Instead of

if a == "a" then
b = 1
elseif a == "b" then
b = 2
elseif a == "c" then
b = 3
end

You can write

b=(a=="a")+2(a=="b")+3(a=="c")
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
03 Oct 2013 06:57 AM
Oh yeah I use those sometimes. Not too too often because they're often not applicable for what I'm doing, but sometimes.
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
03 Oct 2013 06:58 AM
Interesting. :P
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
03 Oct 2013 07:05 AM
Yeah. Except I don't try add numbers to Booleans. At least not in Lua (well, you can in cake... I mean... muffin...)


- As, return n < 10 and "0" or ""
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
03 Oct 2013 07:11 AM
"b=(a=="a")+2(a=="b")+3(a=="c")"

Would error.
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
03 Oct 2013 08:05 AM
That's why ROBLOX should make bool=int
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
03 Oct 2013 08:34 AM
try replacing +n with ( and n or ) <<< just without the parenthesis.
Then it would give the result you expected.

- As, I like not having Booleans doing the stuff you want it to. That makes things interesting. Argh, zig...
Report Abuse
bohdan77 is not online. bohdan77
Joined: 10 Aug 2008
Total Posts: 7944
03 Oct 2013 02:19 PM
But it looks so unreadable doing that. :( I do it sometimes for quick stuff, I guess.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
03 Oct 2013 02:33 PM
b="a"
b=(b=="a" and 1) or (b=="b" and 2) or (b=="c" and 3)
print(b)
>1
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
03 Oct 2013 02:38 PM
[ Content Deleted ]
Report Abuse
sncplay42 is not online. sncplay42
Joined: 27 Nov 2008
Total Posts: 11891
03 Oct 2013 03:00 PM
Oysi: I think he wants you to read it like mathematical notation with == returning 0 or 1

>That's why ROBLOX should make bool=int

Please no.

Actually I think I recall hearing that the creators of Lua actually regret even letting nil be false (they didn't introduce an actual boolean type for several versions, so originally nil was *the* false value).
Report Abuse
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
03 Oct 2013 09:48 PM
c = {'a', 'b', 'c'}

...

for i,v in pairs(c) do
b = (a == v and i)
end

I don't see why not
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
03 Oct 2013 11:59 PM
[ Content Deleted ]
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
04 Oct 2013 05:34 AM
You do know that I just gave examples, right?
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
04 Oct 2013 05:51 AM
[ Content Deleted ]
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
04 Oct 2013 05:52 AM
Yeah, my mistake, it wasn't really meant to be for Lua, but some other languages, I just wrote it in Lua syntax.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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