Where do I set up a global variable?

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Where do I set up a global variable?

#1 Post by jenx »

I need a global variable accessible by all functions. Just the one!

Where in my add on should I place

my variable = 15

?
MADNESS rocks

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Where do I set up a global variable?

#2 Post by darkgod »

you cna define it form anywhere, i'd say the load hook though, and you make one explicitly this way: _G.foo = bar
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

jenx
Sher'Tul Godslayer
Posts: 2263
Joined: Mon Feb 14, 2011 11:16 pm

Re: Where do I set up a global variable?

#3 Post by jenx »

darkgod wrote:you cna define it form anywhere, i'd say the load hook though, and you make one explicitly this way: _G.foo = bar
Thanks.

After a bit of experimenting, I realised I had to call it every time as _G.foo (duh!), not just foo.
MADNESS rocks

Post Reply