1
0
Fork 0
mirror of https://github.com/Reuh/candran.git synced 2025-10-27 09:59:29 +00:00

Improve error reporting in candran.searcher

This commit is contained in:
Étienne Fildadut 2020-12-24 16:24:26 +01:00
parent c8c35e93a8
commit c8aa4f2a08
2 changed files with 36 additions and 18 deletions

View file

@ -14,7 +14,7 @@
local unpack = unpack or table.unpack
local candran = {
VERSION = "0.13.0"
VERSION = "0.13.1"
}
--- Default options.
@ -38,7 +38,7 @@ if _VERSION == "Lua 5.1" then
elseif _VERSION == "Lua 5.2" then
candran.default.target = "lua51"
elseif _VERSION == "Lua 5.3" then
--candran.default.target = "lua53"
candran.default.target = "lua53"
end
--- Run the preprocessor
@ -306,9 +306,18 @@ end
function candran.searcher(modpath)
local filepath = util.search(modpath, {"can"})
if not filepath then
return "\n\tno candran file in package.path"
if _VERSION == "Lua 5.4" then
return "no candran file in package.path"
else
return "\n\tno candran file in package.path"
end
end
local r, s = candran.loadfile(filepath)
if r then
return r
else
return s
end
return candran.loadfile(filepath)
end
--- Register the Candran package searcher.