Do global variables work between worlds?
#1
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.
[Image: OAgDZ.png]
Reply
#2
Scripting section.
[Image: chaosthegreat.png]
Reply
#3
(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.
[Image: OAgDZ.png]
Reply
#4
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.
Reply
#5
(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.


My solution would be to have a variable object and then access it from other Worlds using getWorld.

_G variables are shared.
Reply
#6
(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.


My solution would be to have a variable object and then access it from other Worlds using getWorld.

_G variables are shared.

Does that mean if I define a global variable in the main world I can use it in a second world?
[Image: OAgDZ.png]
Reply
#7
(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.


My solution would be to have a variable object and then access it from other Worlds using getWorld.

_G variables are shared.

Does that mean if I define a global variable in the main world I can use it in a second world?

Yes.
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)