View Single Post
03-10-21, 10:14 PM   #6
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Creating objects makes them global by default. The only exceptions are objects passed into a function and loop objects.

For example, say you have function(self,event), the objects "self" and "event" are automatically local to that function.

In loops, for i=1,10 do makes "i" local and for k,v in pairs(t) do makes "k" and "v" local.

There's also setenv but that's advanced and rarely has uses within WoW's addon environment. WeakAuras makes use of this to keep all objects inside an aura's custom code local.
  Reply With Quote