| 81 | |
| 82 | |
| 83 | static int math_toint (lua_State *L) { |
| 84 | int valid; |
| 85 | lua_Integer n = lua_tointegerx(L, 1, &valid); |
| 86 | if (valid) |
| 87 | lua_pushinteger(L, n); |
| 88 | else { |
| 89 | luaL_checkany(L, 1); |
| 90 | lua_pushnil(L); /* value is not convertible to integer */ |
| 91 | } |
| 92 | return 1; |
| 93 | } |
| 94 | |
| 95 | |
| 96 | static void pushnumint (lua_State *L, lua_Number d) { |
nothing calls this directly
no test coverage detected