Permalink
Browse files

New module loader properly halts when load-time error occurs in module.

  • Loading branch information...
Uberi committed Aug 1, 2013
1 parent b0bf52e commit 040282bbe66eccee27194cd709beb56f075bcdb2
Showing with 5 additions and 8 deletions.
  1. +5 −8 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")

0 comments on commit 040282b

Please sign in to comment.