Skip to content

Commit

Permalink
[vm] Add rawiter() function
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy29 committed Feb 2, 2025
1 parent 8b4220c commit b0f1c1f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions VM/src/lbaselib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,24 +233,20 @@ int luaB_next(lua_State* L)
}
}

/*
static int luaB_nexti(lua_State *L)
static int luaB_rawiter(lua_State *L)
{
luaL_checktype(L, 1, LUA_TTABLE);
int i=luaL_optinteger(L,2,0);
i=lua_nexti(L,1,i);
if (i) {
i=lua_rawiter(L,1,i);
if (i>=0) {
lua_pushinteger(L,i);
return 3;
}
else
{
lua_pushnil(L);
return 1;
}
lua_pushcclosure(L, luaB_nexti, "nexti", 1);
lua_pushnil(L);
return 1;
}

/*
static int pairsnexti(lua_State *L)
{
luaL_checktype(L, 1, LUA_TTABLE);
Expand All @@ -266,6 +262,7 @@ static int pairsnexti(lua_State *L)
lua_pushnil(L);
return 1;
}
lua_pushcclosure(L, luaB_nexti, "nexti", 1);
}
*/

Expand Down Expand Up @@ -569,6 +566,7 @@ static const luaL_Reg base_funcs[] = {
{"getfenv", luaB_getfenv},
{"getmetatable", luaB_getmetatable},
{"next", luaB_next},
{"rawiter", luaB_rawiter},
{"newproxy", luaB_newproxy},
{"print", luaB_print},
{"rawequal", luaB_rawequal},
Expand Down

0 comments on commit b0f1c1f

Please sign in to comment.