1
0
mirror of https://github.com/lua/lua synced 2026-06-08 15:34:49 +00:00

Bug: 'string.concat' error message uses wrong format

This commit is contained in:
Roberto Ierusalimschy
2021-02-15 13:31:45 -03:00
parent 38cc7d40a4
commit c03c527fd2
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ static int tmove (lua_State *L) {
static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) {
lua_geti(L, 1, i);
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for 'concat'",
luaL_error(L, "invalid value (%s) at index %I in table for 'concat'",
luaL_typename(L, -1), i);
luaL_addvalue(b);
}
+3
View File
@@ -361,6 +361,9 @@ assert(load("return 1\n--comment without ending EOL")() == 1)
checkerror("table expected", table.concat, 3)
checkerror("at index " .. maxi, table.concat, {}, " ", maxi, maxi)
-- '%' escapes following minus signal
checkerror("at index %" .. mini, table.concat, {}, " ", mini, mini)
assert(table.concat{} == "")
assert(table.concat({}, 'x') == "")
assert(table.concat({'\0', '\0\1', '\0\1\2'}, '.\0.') == "\0.\0.\0\1.\0.\0\1\2")