Do global variables work between worlds? - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13) +--- Thread: Do global variables work between worlds? (/showthread.php?tid=7895) |
Do global variables work between worlds? - Jupiter - 08-11-2011 What I mean by this is that when you make a global variable. for example _G.var = "hi" could you use it in another world? I would test this out right now but Java isn't working on my computer atm, I'm trying to fix it right now. RE: Do global variables work between worlds? - Chaos - 08-11-2011 Scripting section. RE: Do global variables work between worlds? - Jupiter - 08-12-2011 (08-11-2011, 10:08 PM)Chaos Wrote: Scripting section. Well I assumed it went in the Help section but please don't post unless you have something useful to say. Posting "Scripting section." helps me in no way. RE: Do global variables work between worlds? - Qwertygiy - 08-12-2011 As it is, I THINK that each World is its own seperate entity, meaning global variables are not shared. I could be wrong though. My solution would be to have a variable object and then access it from other Worlds using getWorld. RE: Do global variables work between worlds? - Jacob__mybb_import1 - 08-12-2011 (08-12-2011, 12:20 AM)Qwertygiy Wrote: As it is, I THINK that each World is its own seperate entity, meaning global variables are not shared. I could be wrong though. _G variables are shared. RE: Do global variables work between worlds? - Jupiter - 08-12-2011 (08-12-2011, 01:22 AM)Jacob_ Wrote:(08-12-2011, 12:20 AM)Qwertygiy Wrote: As it is, I THINK that each World is its own seperate entity, meaning global variables are not shared. I could be wrong though. Does that mean if I define a global variable in the main world I can use it in a second world? RE: Do global variables work between worlds? - Jacob__mybb_import1 - 08-12-2011 (08-12-2011, 01:30 AM)Jupiter Wrote:(08-12-2011, 01:22 AM)Jacob_ Wrote:(08-12-2011, 12:20 AM)Qwertygiy Wrote: As it is, I THINK that each World is its own seperate entity, meaning global variables are not shared. I could be wrong though. Yes. |