LUA_SETUPVALUE(3) Library Functions Manual LUA_SETUPVALUE(3)

lua_setupvaluesets the value of a closure's upvalue, function indicator [- (0|1), +0, -]

#include <lua.h>

const char *
lua_setupvalue(lua_State *L, int funcindex, int n);

() sets the value of a closure's upvalue. It assigns the value at the top of the stack to the upvalue and returns its name. It also pops the value from the stack. Parameters funcindex and n are as in the lua_getupvalue(3).

Returns NULL (and pops nothing) when the index is greater than the number of upvalues.

Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.

The lua_setupvalue() manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.

July 13, 2022 Debian