MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / auxupvalue

Function auxupvalue

lib/lua/src/ldblib.c:258–267  ·  view source on GitHub ↗

** get (if 'get' is true) or set an upvalue from a closure */

Source from the content-addressed store, hash-verified

256** get (if 'get' is true) or set an upvalue from a closure
257*/
258static int auxupvalue (lua_State *L, int get) {
259 const char *name;
260 int n = (int)luaL_checkinteger(L, 2); /* upvalue index */
261 luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */
262 name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
263 if (name == NULL) return 0;
264 lua_pushstring(L, name);
265 lua_insert(L, -(get+1)); /* no-op if get is false */
266 return get + 1;
267}
268
269
270static int db_getupvalue (lua_State *L) {

Callers 2

db_getupvalueFunction · 0.85
db_setupvalueFunction · 0.85

Calls 5

luaL_checkintegerFunction · 0.85
luaL_checktypeFunction · 0.85
lua_getupvalueFunction · 0.85
lua_setupvalueFunction · 0.85
lua_pushstringFunction · 0.85

Tested by

no test coverage detected