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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: What exactly does local do?

Previous Thread :: Next Thread 
awsomeparkour is online. awsomeparkour
Joined: 05 Sep 2010
Total Posts: 220
21 Mar 2014 11:04 PM
I vaguely understand it, I never fully understood what it meant. Be specific on exactly what it does and what it is used for.
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
21 Mar 2014 11:06 PM
The local variable can only be used in its scope
EXAMPLE:

while true do
local pie = 1

for _,v in pairs (lol) do
--pie can be used here
local apples = 5
end
--apples can not be used here
-- if it is...
print(apples)
end
>ERROR: apples does not exist
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
21 Mar 2014 11:07 PM
http://wiki.roblox.com/index.php?title=Scope
Report Abuse
awsomeparkour is online. awsomeparkour
Joined: 05 Sep 2010
Total Posts: 220
21 Mar 2014 11:09 PM
What exactly is a scope? I think I know what it is I just want to be sure.
Report Abuse
LeadStormTest is not online. LeadStormTest
Joined: 14 Mar 2014
Total Posts: 25
21 Mar 2014 11:09 PM
^It wouldn't error, it would just return nil.

local makes the variable values in the scope have a different value.

Example that is different than above:

ducks = 5
do--starts a new scope
local ducks = 7534
print(ducks)--prints 7534
end
print(ducks)--prints 5

Report Abuse
awsomeparkour is online. awsomeparkour
Joined: 05 Sep 2010
Total Posts: 220
21 Mar 2014 11:13 PM
btw lead I replied on the other forum post please reply. And thanks kiwi.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
21 Mar 2014 11:59 PM
local is u k
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