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