MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaH_next

Function luaH_next

extlibs/lua/src/ltable.c:305–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303
304
305int luaH_next (lua_State *L, Table *t, StkId key) {
306 unsigned int asize = luaH_realasize(t);
307 unsigned int i = findindex(L, t, s2v(key), asize); /* find original key */
308 for (; i < asize; i++) { /* try first array part */
309 if (!isempty(&t->array[i])) { /* a non-empty entry? */
310 setivalue(s2v(key), i + 1);
311 setobj2s(L, key + 1, &t->array[i]);
312 return 1;
313 }
314 }
315 for (i -= asize; cast_int(i) < sizenode(t); i++) { /* hash part */
316 if (!isempty(gval(gnode(t, i)))) { /* a non-empty entry? */
317 Node *n = gnode(t, i);
318 getnodekey(L, s2v(key), n);
319 setobj2s(L, key + 1, gval(n));
320 return 1;
321 }
322 }
323 return 0; /* no more elements */
324}
325
326
327static void freehash (lua_State *L, Table *t) {

Callers 1

lua_nextFunction · 0.85

Calls 2

luaH_realasizeFunction · 0.85
findindexFunction · 0.85

Tested by

no test coverage detected