lua-users home
lua-l archive

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

hello, "Kalle Wikstrand" <>.

On Thu, 13 Sep 2007 10:14:39 +0200
"Kalle Wikstrand" <> wrote:

> Is there no easy way to do this? Something like
> lua_getfield(pLuaState, Enemy, Hitpoints); would be really nice. And
> what about tables in tables?
you should construct this functions using provided API. Lua API doesn't
try to cover all cases (just like the language itself), but it gives you
enough tools to build exactly what you need.

btw, the simpliest (and the slowest?) solution may be

luaL_dostring(L, "Enemy.Hitpoints");
int hp = lua_tointeger(L, -1);
/*lua_settop(L, 0);*/

ps please, don't use this code in serious apps! %-)