MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_arith

Function lua_arith

third-party/lua-5.5.0/src/lapi.c:333–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331
332
333LUA_API void lua_arith (lua_State *L, int op) {
334 lua_lock(L);
335 if (op != LUA_OPUNM && op != LUA_OPBNOT)
336 api_checkpop(L, 2); /* all other operations expect two operands */
337 else { /* for unary operations, add fake 2nd operand */
338 api_checkpop(L, 1);
339 setobjs2s(L, L->top.p, L->top.p - 1);
340 api_incr_top(L);
341 }
342 /* first operand at top - 2, second at top - 1; result go to top - 2 */
343 luaO_arith(L, op, s2v(L->top.p - 2), s2v(L->top.p - 1), L->top.p - 2);
344 L->top.p--; /* pop second operand */
345 lua_unlock(L);
346}
347
348
349LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {

Callers 1

arithFunction · 0.70

Calls 1

luaO_arithFunction · 0.70

Tested by

no test coverage detected