lua-users home
lua-l archive

Help getting local variables from Lua

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


Hello,
Sorry if this has been asked and answered properly, I did some searches and
didn't find specifically what I was looking for..
I'm having trouble getting local variables from scripts.
The only reason I wanted to do it was to make it easier for my script writers,
by letting me populate global tables from script local variables.
I've messed around with lua_getfenv but I get a nil variable back. Does this
look even remotely correct?
-- in lua script i have --------
local SELF = {}
 
function SELF.onDamage( )
 -- do some stuff
end
--------------------------------
// in C i have
luaL_loadfile( pLua, buffer );
lua_getfenv( pLua, -1 );
lua_pushstring( pLua, "SELF" );
lua_gettable( pLua, -2 );
Thanks in advance.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

AltStyle によって変換されたページ (->オリジナル) /