MCPcopy Create free account
hub / github.com/DFHack/dfhack / math_toint

Function math_toint

depends/lua/src/lmathlib.c:83–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83static 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
96static void pushnumint (lua_State *L, lua_Number d) {

Callers

nothing calls this directly

Calls 4

lua_tointegerxFunction · 0.85
lua_pushintegerFunction · 0.85
luaL_checkanyFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected