| 275 | |
| 276 | |
| 277 | static void trymt (lua_State *L, const char *mtname) { |
| 278 | lua_settop(L, 2); /* back to the original arguments */ |
| 279 | if (l_unlikely(lua_type(L, 2) == LUA_TSTRING || |
| 280 | !luaL_getmetafield(L, 2, mtname))) |
| 281 | luaL_error(L, "attempt to %s a '%s' with a '%s'", mtname + 2, |
| 282 | luaL_typename(L, -2), luaL_typename(L, -1)); |
| 283 | lua_insert(L, -3); /* put metamethod before arguments */ |
| 284 | lua_call(L, 2, 1); /* call metamethod */ |
| 285 | } |
| 286 | |
| 287 | |
| 288 | static int arith (lua_State *L, int op, const char *mtname) { |
no test coverage detected