]> git.lizzy.rs Git - worldedit.git/commitdiff
Version information is now available via the API.
authorUberi <azhang9@gmail.com>
Tue, 10 Dec 2013 06:47:32 +0000 (01:47 -0500)
committerUberi <azhang9@gmail.com>
Tue, 10 Dec 2013 06:47:32 +0000 (01:47 -0500)
WorldEdit API.md
worldedit/init.lua
worldedit_commands/init.lua

index 22441d297cdb16a424c9823557888ea3b68fec3d..4169cbe5d91e745b31e64d15aa454c34297e6aa0 100644 (file)
@@ -6,13 +6,24 @@ If needed, individual modules such as visualization.lua can be removed without a
 \r
 For more information, see the [README](README.md).\r
 \r
+General\r
+-------\r
+\r
+### value = worldedit.version\r
+\r
+Contains the current version of WorldEdit in a table of the form `{major=MAJOR_INTEGER, minor=MINOR_INTEGER}`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for version checking purposes.\r
+\r
+### value = worldedit.version_string\r
+\r
+Contains the current version of WorldEdit in the form of a string `"MAJOR_INTEGER.MINOR_INTEGER"`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for display purposes.\r
+\r
 Manipulations\r
 -------------\r
 Contained in manipulations.lua, this module allows several node operations to be applied over a region.\r
 \r
 ### count = worldedit.set(pos1, pos2, nodename)\r
 \r
-Sets a region defined by positions `pos1` and `pos2` to `nodename`. To clear to region, use "air" as the value of `nodename`.\r
+Sets a region defined by positions `pos1` and `pos2` to `nodename`. To clear a region, use "air" as the value of `nodename`.\r
 \r
 Returns the number of nodes set.\r
 \r
index 6d3efe40a2b5f5b3e09510a483e689b1b9191cca..a6361b58b763c1729ea93d645ac975c1a4e8dc4f 100644 (file)
@@ -1,3 +1,7 @@
+worldedit = worldedit or {}\r
+worldedit.version = {major=1, minor=0}\r
+worldedit.version_string = "1.0"\r
+\r
 assert(minetest.get_voxel_manip, string.rep(">", 300) .. "HEY YOU! YES, YOU OVER THERE. THIS VERSION OF WORLDEDIT REQUIRES MINETEST 0.4.8 OR LATER! YOU HAVE AN OLD VERSION." .. string.rep("<", 300))\r
 \r
 local path = minetest.get_modpath(minetest.get_current_modname())\r
index 99776740baaf6edb55e56c40fab7a417696cee3b..3ce26ebf7098dc6b4fa7d3d8aaeb8e84fab99758 100644 (file)
@@ -54,7 +54,7 @@ minetest.register_chatcommand("/about", {
        params = "",\r
        description = "Get information about the mod",\r
        func = function(name, param)\r
-               worldedit.player_notify(name, "WorldEdit 1.0 is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/MineTest-WorldEdit/")\r
+               worldedit.player_notify(name, "WorldEdit " .. worldedit.version_string .. " is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/MineTest-WorldEdit/")\r
        end,\r
 })\r
 \r
@@ -247,9 +247,9 @@ minetest.register_chatcommand("/volume", {
                local volume = worldedit.volume(pos1, pos2)\r
                local abs = math.abs\r
                worldedit.player_notify(name, "current region has a volume of " .. volume .. " nodes ("\r
-                       .. abs(pos2.x - pos1.x) .. "*"\r
-                       .. abs(pos2.y - pos1.y) .. "*"\r
-                       .. abs(pos2.z - pos1.z) .. ")")\r
+                       .. abs(pos2.x - pos1.x) + 1 .. "*"\r
+                       .. abs(pos2.y - pos1.y) + 1 .. "*"\r
+                       .. abs(pos2.z - pos1.z) + 1 .. ")")\r
        end,\r
 })\r
 \r