Skip to content
Snippets Groups Projects
Commit 2c71fd7f authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge remote-tracking branch 'origin/gh-1133-multiline-lua-in-console' into 1.6

parents 92db0df7 b27871aa
No related branches found
No related tags found
No related merge requests found
......@@ -128,7 +128,20 @@ local function local_read(self)
return nil
end
buf = buf..line
if #buf >= #delim and buf:sub(#buf - #delim + 1) == delim then
if delim == "" then
-- stop once a complete Lua statement is entered
local fn, err = loadstring(buf)
if fn ~= nil or not string.find(err, " near '<eof>'$") then
-- valid Lua code or a syntax error not due to
-- an incomplete input
break
end
if loadstring('return '..buf) ~= nil then
-- certain obscure inputs like '(42\n)' yield the
-- same error as incomplete statement
break
end
elseif #buf >= #delim and buf:sub(#buf - #delim + 1) == delim then
buf = buf:sub(0, #buf - #delim)
break
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment