lua-users home
lua-l archive

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


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