MCPcopy Create free account
hub / github.com/PlutoLang/Pluto / lua_arith

Function lua_arith

src/lapi.cpp:374–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372
373
374LUA_API void lua_arith (lua_State *L, int op) {
375 lua_lock(L);
376 if (op != LUA_OPUNM && op != LUA_OPBNOT)
377 api_checkpop(L, 2); /* all other operations expect two operands */
378 else { /* for unary operations, add fake 2nd operand */
379 api_checkpop(L, 1);
380 setobjs2s(L, L->top.p, L->top.p - 1);
381 api_incr_top(L);
382 }
383 /* first operand at top - 2, second at top - 1; result go to top - 2 */
384 luaO_arith(L, op, s2v(L->top.p - 2), s2v(L->top.p - 1), L->top.p - 2);
385 L->top.p--; /* pop second operand */
386 lua_unlock(L);
387}
388
389
390LUA_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