diff --git a/error_handling.lua b/error_handling.lua index 33f9764..ba3389a 100644 --- a/error_handling.lua +++ b/error_handling.lua @@ -115,6 +115,9 @@ print_error = function(error_message, start_fn, stop_fn) calling_fn.lastlinedefined = assert(map[calling_fn.lastlinedefined]) end local filename, start, stop = calling_fn.source:match('@([^[]*)%[([0-9]+):([0-9]+)]') + if not filename then + filename, start = calling_fn.source:match('@([^[]*)%[([0-9]+)]') + end assert(filename) local file = files.read(filename) if calling_fn.name then diff --git a/error_handling.moon b/error_handling.moon index f43d6ba..97e5fe6 100644 --- a/error_handling.moon +++ b/error_handling.moon @@ -75,6 +75,8 @@ print_error = (error_message, start_fn, stop_fn)-> calling_fn.lastlinedefined = assert(map[calling_fn.lastlinedefined]) --calling_fn.short_src = calling_fn.source\match('"([^[]*)') filename,start,stop = calling_fn.source\match('@([^[]*)%[([0-9]+):([0-9]+)]') + if not filename + filename,start = calling_fn.source\match('@([^[]*)%[([0-9]+)]') assert(filename) file = files.read(filename) -- TODO: get name properly