lua-users home
lua-l archive

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


> The Manual says:
> (1)
> >We say that an index is valid if it lies between 1 and the stack top
> >(that is, if 1 ? abs(index) ? top).
> 
> (2)
> >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

-- Roberto