| 71 | |
| 72 | |
| 73 | static int math_toint (lua_State *L) { |
| 74 | int valid; |
| 75 | lua_Integer n = lua_tointegerx(L, 1, &valid); |
| 76 | if (l_likely(valid)) |
| 77 | lua_pushinteger(L, n); |
| 78 | else { |
| 79 | luaL_checkany(L, 1); |
| 80 | luaL_pushfail(L); /* value is not convertible to integer */ |
| 81 | } |
| 82 | return 1; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | static void pushnumint (lua_State *L, lua_Number d) { |
nothing calls this directly
no test coverage detected