[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is this access to Table members "safe"?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 6 May 2004 08:21:15 -0300
>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