mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-11-05 18:10:38 +01:00
New module loader properly halts when load-time error occurs in module.
This commit is contained in:
parent
b0bf52e9b6
commit
040282bbe6
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user