Navigation Menu

Skip to content

Commit

Permalink
New module loader properly halts when load-time error occurs in module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Uberi committed Aug 1, 2013
1 parent b0bf52e commit 040282b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions 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")
Expand Down

0 comments on commit 040282b

Please sign in to comment.