mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
prefix file path with @ when loading string
This commit is contained in:
parent
f10ec9d8ad
commit
c73762e00e
@ -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(...))
|
||||
|
@ -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 = (...) ->
|
||||
|
Loading…
Reference in New Issue
Block a user