lua-users home
lua-l archive

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


On 4/18/06, 陈果 <guo.chen.cn@gmail.com> wrote:
> Thank you very much. The problem is just like what you have said.
> But I still wonder why the call to "lua_getmetatable(L, -1)" doesn't push
> nil onto the stack? I tried lua_isnil followed lua_getmetatable(L, -1) but
> it failed to report true.

lua_getmetatable does not push anything on the stack if its parameter
has no metatable.  You have to check its return value.

This is documented in the manual:
http://www.lua.org/manual/5.1/manual.html#lua_getmetatable

Greg F