lua-users home
lua-l archive

RE: pushing a table

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


> I want to store a pointer to a table in a c++ class, then 
> push the table onto the lua stack, and call a lua method that 
> accepts the table as the first param.
> 
> I don't seem to be able to store a table as a void* and then 
> push it as a table via the lua c api ...
You'll have to store the table in the registry and look it up when you need
it.
Alternativately, a C++ enhanced distribution of Lua (http://luaplus.org/)
allows tables (and other Lua types) to be stored in regular C++ objects
(called LuaObject) and maintained outside the stack or registry. That is:
class MyClass
{
 LuaObject m_obj;
};
m_obj = luaState->GetGlobal("SomeTable");
Josh

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