MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / checkclosemth

Function checkclosemth

xrepo/packages/l/lua/port/lua/src/lfunc.c:126–134  ·  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

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

Callers 1

luaF_newtbcupvalFunction · 0.85

Calls 3

luaG_findlocalFunction · 0.85
luaG_runerrorFunction · 0.85
luaT_gettmbyobjFunction · 0.70

Tested by

no test coverage detected