From b174b8c00026253fd40ec262e430b0bb764e31ea Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Sat, 25 Jan 2025 20:40:09 -0600 Subject: work --- src/preload.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/preload.lua') diff --git a/src/preload.lua b/src/preload.lua index ca2dc9a..5b4034d 100644 --- a/src/preload.lua +++ b/src/preload.lua @@ -3,6 +3,7 @@ --[[ rewrite traceback function to map file names and line numbers to moonscript ]] +local require_order = {} local old_traceback = debug.traceback debug.traceback = function(...) local orig_traceback = old_traceback(...) @@ -23,9 +24,30 @@ debug.traceback = function(...) end end return string.format("%s:%d:", filename, linenum) - end) + end) .. "\nRequire order: [" .. table.concat(require_order, ",\n") .. "]" end +local old_require = require +local required = {} +require = function(...) + args = {...} + if not required[args[1]] then + required[args[1]] = true + table.insert(require_order, args[1]) + end + return old_require(...) +end + +--[[ +Display where print statements are comming from + +local oldprint = print +print = function(...) + oldprint(...) + oldprint(debug.traceback()) +end +]] + -- Override tostring to display more info about the table local old_tostring = tostring local numtabs = 0 -- cgit v1.2.3-70-g09d2