MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaB_pairs

Function luaB_pairs

3rd/lua-5.4.3/src/lbaselib.c:264–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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