mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
Add moar comments
This commit is contained in:
parent
442cb8a8d8
commit
cae75ec5a2
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)..".")
|
||||
|
Loading…
Reference in New Issue
Block a user