| 394 | } |
| 395 | |
| 396 | static int INext(lua_State* pState) { |
| 397 | // 1 table |
| 398 | // [2 index] (optional,start to 1) |
| 399 | if (!lua_istable(pState, 1)) { |
| 400 | SCRIPT_BEGIN(pState) |
| 401 | SCRIPT_ERROR("inext on a ", lua_typename(pState,lua_type(pState, 1)), " value") |
| 402 | SCRIPT_END |
| 403 | return 0; |
| 404 | } |
| 405 | if (lua_getmetatable(pState, 1)) { |
| 406 | lua_getfield(pState, -1, "|items"); |
| 407 | lua_replace(pState, -2); |
| 408 | if (!lua_istable(pState, -1)) |
| 409 | lua_pop(pState, 1); |
| 410 | else |
| 411 | lua_replace(pState, 1); |
| 412 | }; |
| 413 | if (lua_gettop(pState) < 2) |
| 414 | lua_pushnumber(pState,1); |
| 415 | else |
| 416 | lua_pushnumber(pState, lua_tonumber(pState,2)+1); |
| 417 | lua_pushvalue(pState, -1); |
| 418 | lua_gettable(pState, 1); |
| 419 | if (lua_isnil(pState, -1)) { |
| 420 | lua_replace(pState, -2); |
| 421 | return 1; |
| 422 | } |
| 423 | return 2; |
| 424 | } |
| 425 | |
| 426 | int Script::Pairs(lua_State* pState) { |
| 427 | // 1 table |
nothing calls this directly
no outgoing calls
no test coverage detected