diff --git a/worldeditadditions/utils/mesh.lua b/worldeditadditions/utils/mesh.lua index 6b0fa58..792e7a7 100644 --- a/worldeditadditions/utils/mesh.lua +++ b/worldeditadditions/utils/mesh.lua @@ -8,6 +8,7 @@ local wea = worldeditadditions -- ██ ██ ██ ██████ ███████ --- A single face of a Mesh. +-- @class local Face = {} Face.__index = Face @@ -41,6 +42,7 @@ function Face.__eq(a, b) return Face.equal(a, b) end -- ██ ██ ███████ ███████ ██ ██ --- A mesh of faces. +-- @class local Mesh = {} Mesh.__index = Mesh diff --git a/worldeditadditions/utils/node_identification.lua b/worldeditadditions/utils/node_identification.lua index 5f42f18..9fe3324 100644 --- a/worldeditadditions/utils/node_identification.lua +++ b/worldeditadditions/utils/node_identification.lua @@ -76,6 +76,11 @@ end local sapling_aliases = {} + +--- Register a new sapling alias. +-- @param sapling_node_name string The canonical name of the sapling. +-- @param alias string The alias name of the sapling. +-- @returns bool[,string] Whether the alias registration was successful or not. If false, then an error message as a string is also returned as the second value. function worldeditadditions.register_sapling_alias(sapling_node_name, alias) if sapling_aliases[sapling_node_name] ~= nil then return false, "Error: An alias against the node name '"..sapling_node_name.."' already exists." @@ -83,6 +88,9 @@ function worldeditadditions.register_sapling_alias(sapling_node_name, alias) sapling_aliases[alias] = sapling_node_name return true end +--- Convenience function to register many sapling aliases at once. +-- @param tbl [string, string][] A list of tables containing exactly 2 strings in the form { sapling_node_name, alias }. +-- @returns bool[,string] Whether the alias registrations were successful or not. If false, then an error message as a string is also returned as the second value. function worldeditadditions.register_sapling_alias_many(tbl) for i, next in ipairs(tbl) do local success, msg = worldeditadditions.register_sapling_alias( @@ -91,6 +99,7 @@ function worldeditadditions.register_sapling_alias_many(tbl) ) if not success then return success, msg end end + return true end --- Returns the current key ⇒ value table of sapling names and aliases. -- @return table diff --git a/worldeditadditions/utils/vector3.lua b/worldeditadditions/utils/vector3.lua index 75f6698..4acc92f 100644 --- a/worldeditadditions/utils/vector3.lua +++ b/worldeditadditions/utils/vector3.lua @@ -1,7 +1,12 @@ --- A 3-dimensional vector. +-- @class local Vector3 = {} Vector3.__index = Vector3 +--- Creates a new Vector3 instance. +-- @param x number The x co-ordinate value. +-- @param y number The y co-ordinate value. +-- @param z number The z co-ordinate value. function Vector3.new(x, y, z) if type(x) ~= "number" then error("Error: Expected number for the value of x, but received argument of type "..type(x)..".")