[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_setfield, lua_getfield and valid stack index
- From: roberto@... (Roberto Ierusalimschy)
- Date: Mon, 20 Aug 2007 10:47:40 -0300
> The Manual says:
> >We say that an index is valid if it lies between 1 and the stack top
> >(that is, if 1 ? abs(index) ? top).
> >void lua_setfield (lua_State *L, int index, const char *k);
> >Does the equivalent to t[k] = v, where t is the value at the given
> >valid index index and v is the value at the top of the stack,
> It follows from (1) and (2) that
> lua_setfield(L, LUA_REGISTRYINDEX, "some field")
> is incorrect, because LUA_REGISTRYINDEX is not a valid index.
It also says:
(3) Unless otherwise noted, any function that accepts valid indices can
also be called with pseudo-indices