Skip to content

Commit 040282b

Browse files
committed
New module loader properly halts when load-time error occurs in module.
1 parent b0bf52e commit 040282b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

worldedit/init.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
local path = minetest.get_modpath(minetest.get_current_modname())
22

33
local loadmodule = function(path)
4-
local results = {pcall(function()
5-
return dofile(path)
6-
end)}
7-
if results[1] then --successfully loaded module
8-
table.remove(results, 1) --remove status indicator
9-
return unpack(results) --return all results
10-
else --load error
11-
print(results[2])
4+
local file = io.open(path)
5+
if not file then
6+
return
127
end
8+
file:close()
9+
return dofile(path)
1310
end
1411

1512
loadmodule(path .. "/manipulations.lua")

0 commit comments

Comments
 (0)