aboutsummaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-13 13:16:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-03-13 13:16:53 -0300
commitcf71a5ddc742692fad813f89f1c9ef53e1ffde0f (patch)
treedf02305ff3cf05908f21829384e3a7f8699d2331 /lfunc.c
parent2c32bff60987d38a60a58d4f0123f3783da60a63 (diff)
downloadlua-cf71a5ddc742692fad813f89f1c9ef53e1ffde0f.tar.gz
lua-cf71a5ddc742692fad813f89f1c9ef53e1ffde0f.tar.bz2
lua-cf71a5ddc742692fad813f89f1c9ef53e1ffde0f.zip
Details
Several small improvements (code style, warnings, comments, more tests), in particular: - 'lua_topointer' extended to handle strings - raises an error in 'string.format("%10q")' ('%q' with modifiers) - in the manual for 'string.format', the term "option" replaced by "conversion specifier" (the term used by the C standard)
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lfunc.c b/lfunc.c
index 362b798c..3e044b65 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -138,7 +138,8 @@ static int callclosemth (lua_State *L, TValue *uv, StkId level, int status) {
138 if (prepclosingmethod(L, uv, &G(L)->nilvalue)) /* something to call? */ 138 if (prepclosingmethod(L, uv, &G(L)->nilvalue)) /* something to call? */
139 callclose(L, NULL); /* call closing method */ 139 callclose(L, NULL); /* call closing method */
140 else if (!ttisnil(uv)) { /* non-closable non-nil value? */ 140 else if (!ttisnil(uv)) { /* non-closable non-nil value? */
141 const char *vname = luaG_findlocal(L, L->ci, level - L->ci->func, NULL); 141 int idx = cast_int(level - L->ci->func);
142 const char *vname = luaG_findlocal(L, L->ci, idx, NULL);
142 if (vname == NULL) vname = "?"; 143 if (vname == NULL) vname = "?";
143 luaG_runerror(L, "attempt to close non-closable variable '%s'", vname); 144 luaG_runerror(L, "attempt to close non-closable variable '%s'", vname);
144 } 145 }