Merge pull request #189 from moomalade/loadmodule_error

Improve module loadfile() error messages
This commit is contained in:
Manu Evans 2015-08-02 10:45:24 +10:00
commit 247699e6ce
2 changed files with 7 additions and 1 deletions

View File

@ -68,6 +68,9 @@
if chunk then
return chunk
end
if err then
return "\n\tload error " .. err
end
end
end

View File

@ -74,7 +74,10 @@
---
premake.override(_G, "require", function(base, modname, versions)
local mod = base(modname)
local result, mod = pcall(base,modname)
if not result then
error( mod, 3 )
end
if mod and versions and not premake.checkVersion(mod._VERSION, versions) then
error(string.format("module %s %s does not meet version criteria %s",
modname, mod._VERSION or "(none)", versions), 3)