lua-users home
lua-l archive

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


* Christoph Schreiber:

> The following code works. But I don't understand why. That drives me nuts.
>
> int ChildClass::index(lua_State* L)
> {
>     const char* key = luaL_checkstring(L, 2);
>     lua_getmetatable(L, 1);
>     lua_getfield(L, -1, key);
>     if(lua_isnil(L, -1))
>     {
>         luaL_getmetatable(L, Base::classId);
>         lua_getfield(L, -1, key);
>     return 1;
> }

A closing brace is missing in that snippet.  Perhaps you did not copy
the full function?  And you shold really tell us what is so surprising
to you.

Also, please do not post your questions as follow-ups to unrelated
mailing list threads.