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

Function checkclosemth

third-party/lua-5.5.0/src/lfunc.c:127–135  ·  view source on GitHub ↗

** Check whether object at given level has a close metamethod and raise ** an error if not. */

Source from the content-addressed store, hash-verified

125** an error if not.
126*/
127static void checkclosemth (lua_State *L, StkId level) {
128 const TValue *tm = luaT_gettmbyobj(L, s2v(level), TM_CLOSE);
129 if (ttisnil(tm)) { /* no metamethod? */
130 int idx = cast_int(level - L->ci->func.p); /* variable index */
131 const char *vname = luaG_findlocal(L, L->ci, idx, NULL);
132 if (vname == NULL) vname = "?";
133 luaG_runerror(L, "variable '%s' got a non-closable value", vname);
134 }
135}
136
137
138/*

Callers 1

luaF_newtbcupvalFunction · 0.70

Calls 3

luaT_gettmbyobjFunction · 0.70
luaG_findlocalFunction · 0.70
luaG_runerrorFunction · 0.70

Tested by

no test coverage detected