[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANNOUNCE] Lua 5.0 (beta) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 19 Dec 2002 10:11:46 +0000
> Another solution, much more straightforward, would be that LUA had
> something equivalent to lua_pushupvalues() in its API, but instead of
> reading the upvalues of the current call frame, being able to get the
> upvalues of a cclosure at a given stack index.
Lua 5.0 final will have functions to manipulate upvalues, as part of its
LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
Both operate on the function `funcindex' (which may be a Lua function or
a C function). lua_getupvalue pushes the upvalue, lua_setupvalue pops
a value and updates the upvalue. Both return the name of the upvalue (for
Lua functions), "" for C functions, and NULL if the function does not
have a n-th upvalue.