From 040282bbe66eccee27194cd709beb56f075bcdb2 Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Wed, 31 Jul 2013 22:15:52 -0400 Subject: [PATCH] New module loader properly halts when load-time error occurs in module. --- worldedit/init.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/worldedit/init.lua b/worldedit/init.lua index e4ac8f7..02c3494 100644 --- a/worldedit/init.lua +++ b/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")