MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaH_next

Function luaH_next

Source/Misc/lua/src/lua.c:9402–9419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9400
9401
9402int luaH_next (lua_State *L, Table *t, StkId key) {
9403int i = findindex(L, t, key); /* find original element */
9404for (i++; i < t->sizearray; i++) { /* try first array part */
9405if (!ttisnil(&t->array[i])) { /* a non-nil value? */
9406setnvalue(key, cast_num(i+1));
9407setobj2s(L, key+1, &t->array[i]);
9408return 1;
9409}
9410}
9411for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
9412if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */
9413setobj2s(L, key, key2tval(gnode(t, i)));
9414setobj2s(L, key+1, gval(gnode(t, i)));
9415return 1;
9416}
9417}
9418return 0; /* no more elements */
9419}
9420
9421
9422/*

Callers 1

lua_nextFunction · 0.85

Calls 1

findindexFunction · 0.85

Tested by

no test coverage detected