lua-users home
lua-l archive

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


> Hi. I'd like to know which method would be best to do the following.
> 
> I have something like this in the stack (from bottom to top)
> { aTable, aFunction, aValue1, ... aValueN }
> 
> What I want is to put aFunction below aTable.

You want to change their positions?

  lua_pushvalue(L, -(N + 2));  /* push table */
  lua_pushvalue(L, -(N + 2));  /* push function */
  lua_replace(L, -(N + 4));  /* move function into table position */
  lua_replace(L, -(N + 2));  /* move table into function position */

(Indices may be wrong...)

-- Roberto