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

Function luaB_pairs

extlibs/lua/src/lbaselib.c:263–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261
262
263static int luaB_pairs (lua_State *L) {
264 luaL_checkany(L, 1);
265 if (luaL_getmetafield(L, 1, "__pairs") == LUA_TNIL) { /* no metamethod? */
266 lua_pushcfunction(L, luaB_next); /* will return generator, */
267 lua_pushvalue(L, 1); /* state, */
268 lua_pushnil(L); /* and initial value */
269 }
270 else {
271 lua_pushvalue(L, 1); /* argument 'self' to metamethod */
272 lua_call(L, 1, 3); /* get 3 values from metamethod */
273 }
274 return 3;
275}
276
277
278/*

Callers

nothing calls this directly

Calls 4

luaL_checkanyFunction · 0.85
luaL_getmetafieldFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected