diff options
author | Anthony Zhang <azhang9@gmail.com> | 2013-07-31 22:15:52 -0400 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2013-07-31 22:15:52 -0400 |
commit | 040282bbe66eccee27194cd709beb56f075bcdb2 (patch) | |
tree | 19f2c421945b920098a428d01ff6c5e6639ef26e | |
parent | b0bf52e9b688713853b1ab3740d8b6522a1ba5ae (diff) |
New module loader properly halts when load-time error occurs in module.
-rw-r--r-- | worldedit/init.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/worldedit/init.lua b/worldedit/init.lua index e4ac8f7..02c3494 100644 --- a/worldedit/init.lua +++ b/worldedit/init.lua @@ -1,15 +1,12 @@ local path = minetest.get_modpath(minetest.get_current_modname())
local loadmodule = function(path)
- local results = {pcall(function()
- return dofile(path)
- end)}
- if results[1] then --successfully loaded module
- table.remove(results, 1) --remove status indicator
- return unpack(results) --return all results
- else --load error
- print(results[2])
+ local file = io.open(path)
+ if not file then
+ return
end
+ file:close()
+ return dofile(path)
end
loadmodule(path .. "/manipulations.lua")
|