diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/recovery.lua | 6 | ||||
-rw-r--r-- | 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) | |||
70 | if #errors == 0 then | 70 | if #errors == 0 then |
71 | return result | 71 | return result |
72 | else | 72 | else |
73 | local out = "" | 73 | local out = {} |
74 | for i, err in ipairs(errors) do | 74 | for i, err in ipairs(errors) do |
75 | local pos = err[2] | 75 | local pos = err[2] |
76 | local msg = labels[err[1]][2] | 76 | local msg = labels[err[1]][2] |
77 | out = out .. "syntax error: " .. msg .. " (at index " .. pos .. ")\n" | 77 | table.insert(out, "syntax error: " .. msg .. " (at index " .. pos .. ")") |
78 | end | 78 | end |
79 | errors = {} | 79 | errors = {} |
80 | return nil, out | 80 | return nil, table.concat(out, "\n") |
81 | end | 81 | end |
82 | end | 82 | end |
83 | 83 | ||
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) | |||
77 | if #errors == 0 then | 77 | if #errors == 0 then |
78 | return result | 78 | return result |
79 | else | 79 | else |
80 | local out = "" | 80 | local out = {} |
81 | for i, err in ipairs(errors) do | 81 | for i, err in ipairs(errors) do |
82 | local pos = err[2] | 82 | local pos = err[2] |
83 | local msg = errmsgs[err[1]] | 83 | local msg = errmsgs[err[1]] |
84 | local line, col = re.calcline(input, pos) | 84 | local line, col = re.calcline(input, pos) |
85 | out = out .. "syntax error: " .. msg .. " (line " .. line .. ", col " .. col .. ")\n" | 85 | table.insert(out, "syntax error: " .. msg .. " (line " .. line .. ", col " .. col .. ")") |
86 | end | 86 | end |
87 | errors = {} | 87 | errors = {} |
88 | return nil, out | 88 | return nil, table.concat(out, "\n") |
89 | end | 89 | end |
90 | end | 90 | end |
91 | 91 | ||