From 2b99026b05f3c0d1d2eef0892e91cee72f968f5f Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 16 Mar 2020 11:13:42 -0400 Subject: Detect and allow jumping to internal Lua errors. --- core/ui.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'core') 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. -- cgit v1.2.3