diff options
Diffstat (limited to 'lfunc.c')
-rw-r--r-- | lfunc.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include "lua.h" | 15 | #include "lua.h" |
16 | 16 | ||
17 | #include "ldebug.h" | ||
17 | #include "ldo.h" | 18 | #include "ldo.h" |
18 | #include "lfunc.h" | 19 | #include "lfunc.h" |
19 | #include "lgc.h" | 20 | #include "lgc.h" |
@@ -140,6 +141,11 @@ static int closeupval (lua_State *L, TValue *uv, StkId level, int status) { | |||
140 | if (likely(status == LUA_OK)) { | 141 | if (likely(status == LUA_OK)) { |
141 | if (prepclosingmethod(L, uv, &G(L)->nilvalue)) /* something to call? */ | 142 | if (prepclosingmethod(L, uv, &G(L)->nilvalue)) /* something to call? */ |
142 | callclose(L, NULL); /* call closing method */ | 143 | callclose(L, NULL); /* call closing method */ |
144 | else if (!ttisnil(uv)) { /* non-closable non-nil value? */ | ||
145 | const char *vname = luaG_findlocal(L, L->ci, level - L->ci->func, NULL); | ||
146 | if (vname == NULL) vname = "?"; | ||
147 | luaG_runerror(L, "attempt to close non-closable variable '%s'", vname); | ||
148 | } | ||
143 | } | 149 | } |
144 | else { /* there was an error */ | 150 | else { /* there was an error */ |
145 | /* save error message and set stack top to 'level + 1' */ | 151 | /* save error message and set stack top to 'level + 1' */ |