lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

-- in lua script i have --------
local SELF = {}
function SELF.onDamage( )
   -- do some stuff

Locals are not stored in a table. The SELF in your example will simply get collected some time after the script has run since there are no references to SELF left.

There are basically two approaches:

1) Drop the "local" to make SELF a global and you can access that easily. Globals are stored in the script's environment.

2) Explicitly "return SELF" at the end of the script to obtain a reference to it.