Skip to content

Commit c03c527

Browse files
committed
Bug: 'string.concat' error message uses wrong format
1 parent 38cc7d4 commit c03c527

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ltablib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int tmove (lua_State *L) {
146146
static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) {
147147
lua_geti(L, 1, i);
148148
if (!lua_isstring(L, -1))
149-
luaL_error(L, "invalid value (%s) at index %d in table for 'concat'",
149+
luaL_error(L, "invalid value (%s) at index %I in table for 'concat'",
150150
luaL_typename(L, -1), i);
151151
luaL_addvalue(b);
152152
}

testes/strings.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ assert(load("return 1\n--comment without ending EOL")() == 1)
361361

362362

363363
checkerror("table expected", table.concat, 3)
364+
checkerror("at index " .. maxi, table.concat, {}, " ", maxi, maxi)
365+
-- '%' escapes following minus signal
366+
checkerror("at index %" .. mini, table.concat, {}, " ", mini, mini)
364367
assert(table.concat{} == "")
365368
assert(table.concat({}, 'x') == "")
366369
assert(table.concat({'\0', '\0\1', '\0\1\2'}, '.\0.') == "\0.\0.\0\1.\0.\0\1\2")

0 commit comments

Comments
 (0)