MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / luaB_tointeger

Function luaB_tointeger

src/Chain/libraries/glua/lbaselib.cpp:171–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170
171static int luaB_tointeger(lua_State *L)
172{
173 int res = luaB_tonumber(L);
174 if (res > 0 && lua_isinteger(L, -1))
175 {
176 lua_Integer int_result = luaL_checkinteger(L, -1);
177 lua_pop(L, 1);
178 lua_pushinteger(L, int_result);
179 return 1;
180 }
181 else if(res > 0 && lua_isnumber(L, -1))
182 {
183 lua_Number number_result = luaL_checknumber(L, -1);
184 auto int_result = (lua_Integer)number_result;
185 lua_pop(L, 1);
186 lua_pushinteger(L, int_result);
187 return 1;
188 }
189 else
190 {
191 lua_pop(L, res);
192 lua_set_run_error(L, "need pass number or integer value to func tointeger");
193 return luaL_error(L, "need pass number or integer value to func tointeger");
194 // return res;
195 }
196}
197
198
199static int luaB_error(lua_State *L) {

Callers

nothing calls this directly

Calls 6

luaB_tonumberFunction · 0.85
lua_isintegerFunction · 0.85
lua_pushintegerFunction · 0.85
lua_isnumberFunction · 0.85
lua_set_run_errorFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected