MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaH_next

Function luaH_next

freebsd/contrib/openzfs/module/lua/ltable.c:169–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168
169int luaH_next (lua_State *L, Table *t, StkId key) {
170 int i = findindex(L, t, key); /* find original element */
171 for (i++; i < t->sizearray; i++) { /* try first array part */
172 if (!ttisnil(&t->array[i])) { /* a non-nil value? */
173 setnvalue(key, cast_num(i+1));
174 setobj2s(L, key+1, &t->array[i]);
175 return 1;
176 }
177 }
178 for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
179 if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */
180 setobj2s(L, key, gkey(gnode(t, i)));
181 setobj2s(L, key+1, gval(gnode(t, i)));
182 return 1;
183 }
184 }
185 return 0; /* no more elements */
186}
187
188
189/*

Callers 1

lua_nextFunction · 0.70

Calls 1

findindexFunction · 0.70

Tested by

no test coverage detected