MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / trymt

Function trymt

extlibs/lua/src/lstrlib.c:276–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

arithFunction · 0.85

Calls 4

lua_settopFunction · 0.85
lua_typeFunction · 0.85
luaL_getmetafieldFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected