lua-users home
lua-l archive

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


Thanks Kevin and Ashwin for the bloody speedy replies :) these are the fun aspects of Lua I'm looking forward to..

Thanks again,

PT

-----Original Message-----
From: Kevin Baca [mailto:lualist@aidiastudios.com]
Sent: 23 September 2003 23:55
To: 'Lua list'
Subject: RE: Table madness :(


Re-posted:

> 	lua_getglobal(m_LuaVM, "myscript");
> 	if(lua_istable(m_LuaVM,-1)) {
> 		lua_pushstring(m_LuaVM,"debug");
> 		lua_gettable(m_LuaVM,-2);
> 		if(lua_isfunction(m_LuaVM,-1))
Add this:
                  lua_pushvalue( m_LuaVM, -3 );  //self

> 			lua_call(m_LuaVM, 0, 0);

Call like this:
                  lua_call(m_LuaVM, 1, 0);

> 		else
> 			lua_pop(m_LuaVM,1);
> 	}
>