** To be here, either the first operand was a string or the first ** operand didn't have a corresponding metamethod. (Otherwise, that ** other metamethod would have been called.) So, if this metamethod ** doesn't work, the only other option would be for the second ** operand to have a different metamethod. */
| 277 | ** operand to have a different metamethod. |
| 278 | */ |
| 279 | static void trymt (lua_State *L, const char *mtkey, const char *opname) { |
| 280 | lua_settop(L, 2); /* back to the original arguments */ |
| 281 | if (l_unlikely(lua_type(L, 2) == LUA_TSTRING || |
| 282 | !luaL_getmetafield(L, 2, mtkey))) |
| 283 | luaL_error(L, "attempt to %s a '%s' with a '%s'", opname, |
| 284 | luaL_typename(L, -2), luaL_typename(L, -1)); |
| 285 | lua_insert(L, -3); /* put metamethod before arguments */ |
| 286 | lua_call(L, 2, 1); /* call metamethod */ |
| 287 | } |
| 288 | |
| 289 | |
| 290 | static int arith (lua_State *L, int op, const char *mtname) { |
no test coverage detected