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: _G Question

Previous Thread :: Next Thread 
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
24 Dec 2011 12:54 PM
Is _G Locked in a way do i can't make a variable and access it in another script Ex:

Script 1
_G.1 = 123

Script 2
Print(_G.1)

Any help on this would be appreciated.
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
24 Dec 2011 12:59 PM
you have to do it like:
Script 1:
_G["1"] = 123

Script 2:
print(_G["1"] )

>123

~I've been to nil and back.
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
24 Dec 2011 01:00 PM
Ok thank you just trying to make sure I wasn't going to make a broken script before I even start.
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
24 Dec 2011 01:14 PM
Now just checking I can make a table the same way as a variable using _G?
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
24 Dec 2011 01:16 PM
_G can be put before any variable.

_G.t = {"hi"}
_G.o = workspace.Part
_G.s = "wkihgwfidasfh"
_G.i = 45

bon
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
24 Dec 2011 01:17 PM
Ok Thanks
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
24 Dec 2011 01:19 PM
seems to work

_G["table"] = {1,2,3,4,5}
for i = 1,#_G["table"] do
print(_G["table"][i])
end

~I've been to nil and back.
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