MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / math_toint

Function math_toint

3rd/lua-5.4.3/src/lmathlib.c:73–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73static 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
86static void pushnumint (lua_State *L, lua_Number d) {

Callers

nothing calls this directly

Calls 3

lua_tointegerxFunction · 0.85
lua_pushintegerFunction · 0.85
luaL_checkanyFunction · 0.85

Tested by

no test coverage detected