]> git.lizzy.rs Git - worldedit.git/commitdiff
Dynamic module loading - you can now delete any file in the worldedit mod except...
authorAnthony Zhang <azhang9@gmail.com>
Wed, 20 Mar 2013 21:31:00 +0000 (17:31 -0400)
committerAnthony Zhang <azhang9@gmail.com>
Wed, 20 Mar 2013 21:31:00 +0000 (17:31 -0400)
WorldEdit API.md
worldedit/compatibility.lua
worldedit/init.lua

index 464a719606ca6ef7c7ffdffd0605062d0ee5971b..a69062f04e5e482e34fa2a0288e8148884e842bf 100644 (file)
@@ -2,6 +2,8 @@ WorldEdit API
 =============\r
 The WorldEdit API is composed of multiple modules, each of which is independent and can be used without the other. Each module is contained within a single file.\r
 \r
+If needed, individual modules such as visualization.lua can be removed without affecting the rest of the program. The only file that cannot be removed is init.lua, which is necessary for the mod to run.\r
+\r
 For more information, see the [README](README.md).\r
 \r
 Manipulations\r
index 3b9c88984e20d3b47f9d96d2fbf8d60486cb999c..0ea23335aebee4137aec07d2d8eea3b172618ee9 100644 (file)
@@ -1,3 +1,5 @@
+worldedit = worldedit or {}\r
+\r
 worldedit.allocate_old = worldedit.allocate\r
 worldedit.deserialize_old = worldedit.deserialize\r
 worldedit.metasave = function(pos1, pos2, filename)\r
index aaf70ae4f2183db469ddeabf88da45821f4b7414..f3eb9bb942f10ac28ad2e8686a99ecc2976e6555 100644 (file)
@@ -1,7 +1,14 @@
 local path = minetest.get_modpath("worldedit")\r
-dofile(path .. "/manipulations.lua")\r
-dofile(path .. "/primitives.lua")\r
-dofile(path .. "/visualization.lua")\r
-dofile(path .. "/serialization.lua")\r
-dofile(path .. "/code.lua")\r
-dofile(path .. "/compatibility.lua")
\ No newline at end of file
+\r
+local loadmodule = function(path)\r
+       return pcall(function()\r
+               dofile(path)\r
+       end)\r
+end\r
+\r
+loadmodule(path .. "/manipulations.lua")\r
+loadmodule(path .. "/primitives.lua")\r
+loadmodule(path .. "/visualization.lua")\r
+loadmodule(path .. "/serialization.lua")\r
+loadmodule(path .. "/code.lua")\r
+loadmodule(path .. "/compatibility.lua")
\ No newline at end of file