lua

A copy of the Lua development repository
Log | Files | Refs | README

commit c03c527fd207b4ad8f5a8e0f4f2c176bd227c979
parent 38cc7d40a4bcb89314d212fdffd2ca8deebc3cb7
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 15 Feb 2021 13:31:18 -0300

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

Diffstat:
Mltablib.c | 2+-
Mtestes/strings.lua | 3+++
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ltablib.c b/ltablib.c @@ -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); } diff --git a/testes/strings.lua b/testes/strings.lua @@ -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")