@@ -233,24 +233,20 @@ int luaB_next(lua_State* L)
233
233
}
234
234
}
235
235
236
- /*
237
- static int luaB_nexti(lua_State *L)
236
+ static int luaB_rawiter (lua_State *L)
238
237
{
239
238
luaL_checktype (L, 1 , LUA_TTABLE);
240
239
int i=luaL_optinteger (L,2 ,0 );
241
- i=lua_nexti (L,1,i);
242
- if (i) {
240
+ i=lua_rawiter (L,1 ,i);
241
+ if (i>= 0 ) {
243
242
lua_pushinteger (L,i);
244
243
return 3 ;
245
244
}
246
- else
247
- {
248
- lua_pushnil(L);
249
- return 1;
250
- }
251
- lua_pushcclosure(L, luaB_nexti, "nexti", 1);
245
+ lua_pushnil (L);
246
+ return 1 ;
252
247
}
253
248
249
+ /*
254
250
static int pairsnexti(lua_State *L)
255
251
{
256
252
luaL_checktype(L, 1, LUA_TTABLE);
@@ -266,6 +262,7 @@ static int pairsnexti(lua_State *L)
266
262
lua_pushnil(L);
267
263
return 1;
268
264
}
265
+ lua_pushcclosure(L, luaB_nexti, "nexti", 1);
269
266
}
270
267
*/
271
268
@@ -569,6 +566,7 @@ static const luaL_Reg base_funcs[] = {
569
566
{" getfenv" , luaB_getfenv},
570
567
{" getmetatable" , luaB_getmetatable},
571
568
{" next" , luaB_next},
569
+ {" rawiter" , luaB_rawiter},
572
570
{" newproxy" , luaB_newproxy},
573
571
{" print" , luaB_print},
574
572
{" rawequal" , luaB_rawequal},
0 commit comments