| 356 | |
| 357 | |
| 358 | static int luaB_select (lua_State *L) { |
| 359 | int n = lua_gettop(L); |
| 360 | if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { |
| 361 | lua_pushinteger(L, n-1); |
| 362 | return 1; |
| 363 | } |
| 364 | else { |
| 365 | int i = luaL_checkint(L, 1); |
| 366 | if (i < 0) i = n + i; |
| 367 | else if (i > n) i = n; |
| 368 | luaL_argcheck(L, 1 <= i, 1, "index out of range"); |
| 369 | return n - i; |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | |
| 374 | static int luaB_pcall (lua_State *L) { |
nothing calls this directly
no test coverage detected