| 300 | |
| 301 | |
| 302 | LUA_API void lua_arith (lua_State *L, int op) { |
| 303 | lua_lock(L); |
| 304 | if (op != LUA_OPUNM && op != LUA_OPBNOT) |
| 305 | api_checknelems(L, 2); /* all other operations expect two operands */ |
| 306 | else { /* for unary operations, add fake 2nd operand */ |
| 307 | api_checknelems(L, 1); |
| 308 | setobjs2s(L, L->top, L->top - 1); |
| 309 | api_incr_top(L); |
| 310 | } |
| 311 | /* first operand at top - 2, second at top - 1; result go to top - 2 */ |
| 312 | luaO_arith(L, op, L->top - 2, L->top - 1, L->top - 2); |
| 313 | L->top--; /* remove second operand */ |
| 314 | lua_unlock(L); |
| 315 | } |
| 316 | |
| 317 | |
| 318 | LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { |
nothing calls this directly
no test coverage detected