From e2b8cf8f1cb077cb6e787dded03f69e8c0f80094 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 5 Apr 2020 20:11:17 -0400 Subject: Only print post-initialization errors to buffers. This avoids infinite loops. Pre-initialization errors are already shown in textbox dialogs. --- core/ui.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'core') diff --git a/core/ui.lua b/core/ui.lua index b7f110b7..1ec21be1 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -501,13 +501,15 @@ if CURSES then end) end -local lua_error = (not WIN32 and '^/' or '^%a:[/\\]') .. '.-%.lua:%d+:' --- Print internal Lua error messages as they are reported. --- Attempt to mimic the Lua interpreter's error message format so tools that --- look for it can recognize these errors too. -events_connect(events.ERROR, function(text) - if text and text:find(lua_error) then text = 'lua: ' .. text end -- mimic Lua - ui.print(text) +events.connect(events.INITIALIZED, function() + local lua_error = (not WIN32 and '^/' or '^%a:[/\\]') .. '.-%.lua:%d+:' + -- Print internal Lua error messages as they are reported. + -- Attempt to mimic the Lua interpreter's error message format so tools that + -- look for it can recognize these errors too. + events_connect(events.ERROR, function(text) + if text and text:find(lua_error) then text = 'lua: ' .. text end + ui.print(text) + end) end) --[[ The tables below were defined in C. -- cgit v1.2.3