Dynamic module loading - you can now delete any file in the worldedit mod except init.lua, and the relevant functionality will simply not be included.

This commit is contained in:
Anthony Zhang
2013-03-20 17:31:00 -04:00
parent d1828affff
commit 65c218c3e2
3 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,5 @@
worldedit = worldedit or {}
worldedit.allocate_old = worldedit.allocate
worldedit.deserialize_old = worldedit.deserialize
worldedit.metasave = function(pos1, pos2, filename)

View File

@ -1,7 +1,14 @@
local path = minetest.get_modpath("worldedit")
dofile(path .. "/manipulations.lua")
dofile(path .. "/primitives.lua")
dofile(path .. "/visualization.lua")
dofile(path .. "/serialization.lua")
dofile(path .. "/code.lua")
dofile(path .. "/compatibility.lua")
local loadmodule = function(path)
return pcall(function()
dofile(path)
end)
end
loadmodule(path .. "/manipulations.lua")
loadmodule(path .. "/primitives.lua")
loadmodule(path .. "/visualization.lua")
loadmodule(path .. "/serialization.lua")
loadmodule(path .. "/code.lua")
loadmodule(path .. "/compatibility.lua")