From 863983202ce4ef92d9e3a296a682535d157c245d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 23 Jun 2018 17:22:23 -0700 Subject: Fixed up nomsupath behavior and refactored file stuff into its own file. --- error_handling.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'error_handling.lua') diff --git a/error_handling.lua b/error_handling.lua index 90c5991..b0e6dde 100644 --- a/error_handling.lua +++ b/error_handling.lua @@ -1,3 +1,4 @@ +local files = require("files") local debug_getinfo = debug.getinfo local ok, to_lua = pcall(function() return require('moonscript.base').to_lua @@ -97,7 +98,7 @@ print_error = function(error_message, stack_offset) end local filename, start, stop = calling_fn.source:match('@([^[]*)%[([0-9]+):([0-9]+)]') assert(filename) - local file = FILE_CACHE[filename]:sub(tonumber(start), tonumber(stop)) + local file = read_file(filename):sub(tonumber(start), tonumber(stop)) local err_line = get_line(file, calling_fn.currentline):sub(1, -2) local offending_statement = colored.bright(colored.red(err_line:match("^[ ]*(.*)"))) if calling_fn.name then @@ -118,7 +119,7 @@ print_error = function(error_message, stack_offset) else local file ok, file = pcall(function() - return FILE_CACHE[calling_fn.short_src] + return read_file(calling_fn.short_src) end) if not ok then file = nil -- cgit v1.2.3