lua-users home
lua-l archive

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


2015-02-11 5:59 GMT+02:00 张睿 <zrui16@hotmail.com>:
> Section 4.5 of Lua 5.3 document says:
>
>         The registry table is always located at pseudo-index LUA_REGISTRYINDEX, which is a valid index.
>
> Is it correct?

Saying that LUA_REGISTRYINDEX is a pseudo-index means
that most API functions that requires an index into the stack
will work with a pseudo-index too, e.g.

    lua_pushvalue(L,LUA_REGISTRYINDEX);

A few functions must not be used with a pseudo-index.
Each such case is documented specifically, e.g. lua_insert.