From c73762e00ee2e9bb9b2ec70c49e1e24f132a6c09 Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Fri, 6 Jun 2014 14:36:03 -0700 Subject: [PATCH] prefix file path with @ when loading string --- moonscript/base.lua | 4 ++-- moonscript/base.moon | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/moonscript/base.lua b/moonscript/base.lua index fd5a8f9..9c74de4 100644 --- a/moonscript/base.lua +++ b/moonscript/base.lua @@ -60,7 +60,7 @@ moon_loader = function(name) if file then local text = file:read("*a") file:close() - local res, err = loadstring(text, file_path) + local res, err = loadstring(text, "@" .. tostring(file_path)) if not res then error(file_path .. ": " .. err) end @@ -90,7 +90,7 @@ loadfile = function(fname, ...) end local text = assert(file:read("*a")) file:close() - return loadstring(text, fname, ...) + return loadstring(text, "@" .. tostring(fname), ...) end dofile = function(...) local f = assert(loadfile(...)) diff --git a/moonscript/base.moon b/moonscript/base.moon index 7aa3990..371628c 100644 --- a/moonscript/base.moon +++ b/moonscript/base.moon @@ -46,7 +46,7 @@ moon_loader = (name) -> if file text = file\read "*a" file\close! - res, err = loadstring text, file_path + res, err = loadstring text, "@#{file_path}" if not res error file_path .. ": " .. err @@ -72,7 +72,7 @@ loadfile = (fname, ...) -> return nil, err unless file text = assert file\read "*a" file\close! - loadstring text, fname, ... + loadstring text, "@#{fname}", ... -- throws errros dofile = (...) ->