lua-users home
lua-l archive

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


>In attempting to grok how to access a Lua table's members from within a C++
>callback (via a modified Luna), I came up with this:

>#include "ltable.h"
>#include "lstate.h"

> const Table* pTable = (Table*)lua_topointer(L, -1);
> const TObject* pString1 = (TObject*)luaH_getnum((Table*)pTable, 1);

Why use Lua internal functions and types? They are not part of the official API.
Use lua_lua_gettable or lua_rawgeti instead.
--lhf