From 7f6e794999e330c752b9c08442ca0a2a993c8eb9 Mon Sep 17 00:00:00 2001 From: Undecidable Robot Date: Sun, 10 Jul 2016 17:27:39 +0800 Subject: Switching to use the more idiomatic table.concat --- examples/recovery.lua | 6 +++--- examples/recoveryRe.lua | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/recovery.lua b/examples/recovery.lua index 8d894c1..7e039c7 100644 --- a/examples/recovery.lua +++ b/examples/recovery.lua @@ -70,14 +70,14 @@ local function eval(input) if #errors == 0 then return result else - local out = "" + local out = {} for i, err in ipairs(errors) do local pos = err[2] local msg = labels[err[1]][2] - out = out .. "syntax error: " .. msg .. " (at index " .. pos .. ")\n" + table.insert(out, "syntax error: " .. msg .. " (at index " .. pos .. ")") end errors = {} - return nil, out + return nil, table.concat(out, "\n") end end diff --git a/examples/recoveryRe.lua b/examples/recoveryRe.lua index c424160..05acf84 100644 --- a/examples/recoveryRe.lua +++ b/examples/recoveryRe.lua @@ -77,15 +77,15 @@ local function eval(input) if #errors == 0 then return result else - local out = "" + local out = {} for i, err in ipairs(errors) do local pos = err[2] local msg = errmsgs[err[1]] local line, col = re.calcline(input, pos) - out = out .. "syntax error: " .. msg .. " (line " .. line .. ", col " .. col .. ")\n" + table.insert(out, "syntax error: " .. msg .. " (line " .. line .. ", col " .. col .. ")") end errors = {} - return nil, out + return nil, table.concat(out, "\n") end end -- cgit v1.2.3-55-g6feb