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

Function luaH_next

lib/lua/src/ltable.c:349–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347
348
349int luaH_next (lua_State *L, Table *t, StkId key) {
350 unsigned int asize = luaH_realasize(t);
351 unsigned int i = findindex(L, t, s2v(key), asize); /* find original key */
352 for (; i < asize; i++) { /* try first array part */
353 if (!isempty(&t->array[i])) { /* a non-empty entry? */
354 setivalue(s2v(key), i + 1);
355 setobj2s(L, key + 1, &t->array[i]);
356 return 1;
357 }
358 }
359 for (i -= asize; cast_int(i) < sizenode(t); i++) { /* hash part */
360 if (!isempty(gval(gnode(t, i)))) { /* a non-empty entry? */
361 Node *n = gnode(t, i);
362 getnodekey(L, s2v(key), n);
363 setobj2s(L, key + 1, gval(n));
364 return 1;
365 }
366 }
367 return 0; /* no more elements */
368}
369
370
371static 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