aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/ui.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-16 11:13:42 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-16 11:13:42 -0400
commit2b99026b05f3c0d1d2eef0892e91cee72f968f5f (patch)
treebda1e88e6cb88f4ed71c719c9547d72ec33c8cdc /core/ui.lua
parent23a9f5b45e2eedf8366e0b0b45450190b66dd3f2 (diff)
Detect and allow jumping to internal Lua errors.
Diffstat (limited to 'core/ui.lua')
-rw-r--r--core/ui.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/ui.lua b/core/ui.lua
index 43101a96..aec0725f 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -495,7 +495,14 @@ if CURSES then
end)
end
-events_connect(events.ERROR, ui.print)
+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)
+end)
--[[ The tables below were defined in C.