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

Function lua_arith

third-party/lua-5.4.6/src/lapi.c:335–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333
334
335LUA_API void lua_arith (lua_State *L, int op) {
336 lua_lock(L);
337 if (op != LUA_OPUNM && op != LUA_OPBNOT)
338 api_checknelems(L, 2); /* all other operations expect two operands */
339 else { /* for unary operations, add fake 2nd operand */
340 api_checknelems(L, 1);
341 setobjs2s(L, L->top.p, L->top.p - 1);
342 api_incr_top(L);
343 }
344 /* first operand at top - 2, second at top - 1; result go to top - 2 */
345 luaO_arith(L, op, s2v(L->top.p - 2), s2v(L->top.p - 1), L->top.p - 2);
346 L->top.p--; /* remove second operand */
347 lua_unlock(L);
348}
349
350
351LUA_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