DukeCow
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 13176 |
|
|
| 04 Sep 2014 09:12 PM |
Tell me if I'm right or wrong please. Global Variable: a = 1 Can access "a" in other scripts Local Variable: local b = 2 Can access "b" only in that script. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 04 Sep 2014 09:15 PM |
Let's define local and global variables
Global variables -- Variables that are accessible anywhere WITHIN A SCRIPT
Local variables -- Variables that are accessible within THE BLOCK IT IS IN. |
|
|
| Report Abuse |
|
|
DukeCow
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 13176 |
|
|
| 04 Sep 2014 09:17 PM |
o... So any way to put a variable like "a = 1" and access it in another script? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 04 Sep 2014 09:21 PM |
| It would be more complex than it should. |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2014 10:01 PM |
There're local variables. Which are only accessible within that block/scope There're global variables. Which are only accessible within the script that it's in. There're GREAT global variables. Which are accessible from ANY script.
To define a GREAT global variables, you must put them in the Global Table.
_G.variablename = VALUEHERE
To read more, see this page http://wiki.roblox.com/index.php?title=Function_Dump/Core_Functions#G |
|
|
| Report Abuse |
|
|
plistra
|
  |
| Joined: 12 Mar 2014 |
| Total Posts: 859 |
|
|
| 04 Sep 2014 10:09 PM |
_G.varOne = 100 --accessed throughout any script varTwo = 200 --only within the script local varThree = 300 --only within the current scope(s) |
|
|
| Report Abuse |
|
|