MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / lua_arith

Function lua_arith

xrepo/packages/l/lua/port/lua/src/lapi.c:339–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337
338
339LUA_API void lua_arith (lua_State *L, int op) {
340 lua_lock(L);
341 if (op != LUA_OPUNM && op != LUA_OPBNOT)
342 api_checknelems(L, 2); /* all other operations expect two operands */
343 else { /* for unary operations, add fake 2nd operand */
344 api_checknelems(L, 1);
345 setobjs2s(L, L->top, L->top - 1);
346 api_incr_top(L);
347 }
348 /* first operand at top - 2, second at top - 1; result go to top - 2 */
349 luaO_arith(L, op, s2v(L->top - 2), s2v(L->top - 1), L->top - 2);
350 L->top--; /* remove second operand */
351 lua_unlock(L);
352}
353
354
355LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {

Callers 1

arithFunction · 0.85

Calls 1

luaO_arithFunction · 0.85

Tested by

no test coverage detected