[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Moving an element on the stack
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 3 Mar 2010 09:55:05 -0300
> 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