[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Reusing tables from C
- From: Duncan Cross <duncan.cross@...>
- Date: Fri, 16 Sep 2011 11:29:42 +0100
On Fri, Sep 16, 2011 at 11:21 AM, Antonio Vieiro
> Hi all,
> I'm invoking a Lua function from C within a loop, and I'm passing it a
> table as an argument.
> I'd like to reuse the table between invocations (so on each iteration
> of the loop I don't invoke lua_createtable again), but lua_call (or
> lua_pcall) cleans up the stack after the call, so I have little chance
> to reuse the table.
> Is there a trick to do this from C?
Use lua_pushvalue()  to get a second reference to the same table on