| 232 | |
| 233 | |
| 234 | static int luaB_select (lua_State *L) { |
| 235 | int n = lua_gettop(L); |
| 236 | if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { |
| 237 | lua_pushinteger(L, n-1); |
| 238 | return 1; |
| 239 | } |
| 240 | else { |
| 241 | int i = luaL_checkint(L, 1); |
| 242 | if (i < 0) i = n + i; |
| 243 | else if (i > n) i = n; |
| 244 | luaL_argcheck(L, 1 <= i, 1, "index out of range"); |
| 245 | return n - i; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | static int luaB_tostring (lua_State *L) { |
| 250 | luaL_checkany(L, 1); |
nothing calls this directly
no test coverage detected