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: Very very quick question about Lua operators!

Previous Thread :: Next Thread 
Bassics is not online. Bassics
Joined: 24 Apr 2012
Total Posts: 415
14 May 2014 03:55 PM
Is the "and" operator short circuit or long circuit?
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 03:59 PM
90% sure it's short circuit.
Report Abuse
Bassics is not online. Bassics
Joined: 24 Apr 2012
Total Posts: 415
14 May 2014 04:01 PM
It is short circuit.

I just created a test-code to figure it out for myself:

local x = nil
if x and x:IsA("Part") then
print("AH")
end
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 04:03 PM
What does that prove?
Report Abuse
Bassics is not online. Bassics
Joined: 24 Apr 2012
Total Posts: 415
14 May 2014 04:17 PM
If it was long circuit then the if statement would reach x:IsA("Part"), which would error due to x being nil and not having a className.
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