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

Function trymt

third-party/lua-5.5.0/src/lstrlib.c:279–287  ·  view source on GitHub ↗

** 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. */

Source from the content-addressed store, hash-verified

277** operand to have a different metamethod.
278*/
279static 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
290static int arith (lua_State *L, int op, const char *mtname) {

Callers 1

arithFunction · 0.70

Calls 6

lua_settopFunction · 0.70
lua_typeFunction · 0.70
luaL_getmetafieldFunction · 0.70
luaL_errorFunction · 0.70
lua_insertFunction · 0.50
lua_callFunction · 0.50

Tested by

no test coverage detected