lua-users home
lua-l archive

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


Thanks, I'm so fool

2010/11/30 Mike Pall <mikelu-1011@mike.de>
zhiguo zhao wrote:
> But why I lua_getglobal(L,"_G") failed (I don't test this under lua5.1.4,
> but i think it works).

First, "_G" is a table, not a string. So lua_tostring() cannot
possibly work on it. Second, lua_typename(L, tp) expects a type
number and not a stack index. Any results you may get from that
broken C code are undefined.

Please read the documentation of the Lua/C API in the Lua manual,
if you're not familiar with its use.

--Mike