lua-users home
lua-l archive

Re: Change value of upvalue from within function

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


An upvalue index is just like a regular stack index, so you can use
lua_replace with it:
 lua_newtable(L);
 lua_replace(L, lua_upvalueindex(1));
-Rob
On 2012年8月22日 15:52:12 -0600
Eric Tetz <erictetz@gmail.com> wrote:
> If I have a C function called by Lua. It has an upvalue and I'd like
> to change it's value. Possible?
> 
> static int closure_that_has_upvalues( lua_State* L )
> {
> ...
> // how can I change the value of, say, the upvalue at
> lua_upvalueindex(1)?
> 

Attachment: signature.asc
Description: PGP signature


AltStyle によって変換されたページ (->オリジナル) /