MCPcopy Create free account
hub / github.com/Tencent/xLua / lua_checkinteger64

Function lua_checkinteger64

WebGLPlugins/i64lib.c:198–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198static Integer64 lua_checkinteger64(lua_State* L, int pos) {
199 Integer64 n = {0};
200 int type = lua_type(L, pos);
201
202 switch(type) {
203 case LUA_TNUMBER:
204 n.data.i64 = (int64_t)lua_tonumber(L, pos);
205 n.type = Num;
206 break;
207 case LUA_TUSERDATA:
208 if (lua_isinteger64(L, pos)) {
209 n = *(Integer64*)lua_touserdata(L, pos);
210 break;
211 } else {
212 luaL_typerror(L, pos, "Integer64");
213 return n;
214 }
215 default:
216 luaL_typerror(L, pos, "Integer64");
217 return n;
218 }
219
220 return n;
221}
222
223static int int64_add(lua_State* L) {
224 Integer64 lhs = lua_checkinteger64(L, 1);

Callers 11

int64_addFunction · 0.85
int64_subFunction · 0.85
int64_mulFunction · 0.85
int64_divFunction · 0.85
int64_modFunction · 0.85
int64_unmFunction · 0.85
int64_powFunction · 0.85
int64_eqFunction · 0.85
int64_ltFunction · 0.85
int64_leFunction · 0.85
int64_tostringFunction · 0.85

Calls 4

lua_typeFunction · 0.85
lua_tonumberFunction · 0.85
lua_isinteger64Function · 0.85
lua_touserdataFunction · 0.85

Tested by

no test coverage detected