MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaL_setn

Function luaL_setn

deps/lua/src/lauxlib.c:302–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301
302LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
303 t = abs_index(L, t);
304 lua_pushliteral(L, "n");
305 lua_rawget(L, t);
306 if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */
307 lua_pushliteral(L, "n"); /* use it */
308 lua_pushinteger(L, n);
309 lua_rawset(L, t);
310 }
311 else { /* use `sizes' */
312 getsizes(L);
313 lua_pushvalue(L, t);
314 lua_pushinteger(L, n);
315 lua_rawset(L, -3); /* sizes[t] = n */
316 lua_pop(L, 1); /* remove `sizes' */
317 }
318}
319
320
321LUALIB_API int luaL_getn (lua_State *L, int t) {

Callers 3

setnFunction · 0.85
tinsertFunction · 0.85
tremoveFunction · 0.85

Calls 6

lua_rawgetFunction · 0.85
checkintFunction · 0.85
lua_pushintegerFunction · 0.85
lua_rawsetFunction · 0.85
getsizesFunction · 0.85
lua_pushvalueFunction · 0.85

Tested by

no test coverage detected