1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2024-12-25 02:00:39 +01:00

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

This commit is contained in:
Anthony Zhang 2013-07-31 22:15:52 -04:00
parent b0bf52e9b6
commit 040282bbe6

View File

@ -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")