validate 🔗
Collection of functions to validate various parts of WorldEditAdditions notifications to ensure proper input for player names, messages, and colors.
Functions
🔗
Validate name
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to validate. |
Returns
boolean
:
True if the name is valid, false otherwise.
Source
--- Validate name
-- @param name string The name of the player to validate.
-- @returns boolean True if the name is valid, false otherwise.
validate.name = function(name)
{
"type": "function",
"internal": false,
"description": "Validate name",
"directives": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to validate.",
"name": "name",
"type": "string",
"description": "The name of the player to validate."
},
{
"directive": "returns",
"text": "boolean\tTrue if the name is valid, false otherwise.",
"type": "boolean",
"description": "True if the name is valid, false otherwise."
}
],
"line": 14,
"namespace": "validate",
"line_last": 17,
"text": "--- Validate name\n-- @param\tname\tstring\tThe name of the player to validate.\n-- @returns\t\t\tboolean\tTrue if the name is valid, false otherwise. \nvalidate.name = function(name)",
"params": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to validate.",
"name": "name",
"type": "string",
"description": "The name of the player to validate."
}
],
"returns": {
"directive": "returns",
"text": "boolean\tTrue if the name is valid, false otherwise.",
"type": "boolean",
"description": "True if the name is valid, false otherwise."
},
"examples": [],
"name_full": "validate.undefined",
"filename": "worldeditadditions_core/utils/notify/validate.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/validate.lua#L15-L18"
}
🔗
Validate message
Arguments
Name | Type | Default value | Description |
---|---|---|---|
message | string | nil | The message to validate. |
Returns
boolean
:
True if the message is a string, false otherwise.
Source
--- Validate message
-- @param message string The message to validate.
-- @returns boolean True if the message is a string, false otherwise.
validate.message = function(message) return type(message) == "string" end
{
"type": "function",
"internal": false,
"description": "Validate message",
"directives": [
{
"directive": "param",
"text": "message\tstring\tThe message to validate.",
"name": "message",
"type": "string",
"description": "The message to validate."
},
{
"directive": "returns",
"text": "boolean\tTrue if the message is a string, false otherwise.",
"type": "boolean",
"description": "True if the message is a string, false otherwise."
}
],
"line": 31,
"namespace": "validate",
"line_last": 34,
"text": "--- Validate message\n-- @param\tmessage\tstring\tThe message to validate.\n-- @returns\t\t\tboolean\tTrue if the message is a string, false otherwise.\nvalidate.message = function(message) return type(message) == \"string\" end",
"params": [
{
"directive": "param",
"text": "message\tstring\tThe message to validate.",
"name": "message",
"type": "string",
"description": "The message to validate."
}
],
"returns": {
"directive": "returns",
"text": "boolean\tTrue if the message is a string, false otherwise.",
"type": "boolean",
"description": "True if the message is a string, false otherwise."
},
"examples": [],
"name_full": "validate.undefined",
"filename": "worldeditadditions_core/utils/notify/validate.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/validate.lua#L32-L35"
}
🔗
Validate colour
Arguments
Name | Type | Default value | Description |
---|---|---|---|
colour | string | nil | The colour to validate. |
Returns
boolean
:
True if the colour is valid, false otherwise.
Source
--- Validate colour
-- @param colour string The colour to validate.
-- @returns boolean True if the colour is valid, false otherwise.
validate.colour = function(colour)
{
"type": "function",
"internal": false,
"description": "Validate colour",
"directives": [
{
"directive": "param",
"text": "colour\tstring\tThe colour to validate.",
"name": "colour",
"type": "string",
"description": "The colour to validate."
},
{
"directive": "returns",
"text": "boolean\tTrue if the colour is valid, false otherwise.",
"type": "boolean",
"description": "True if the colour is valid, false otherwise."
}
],
"line": 36,
"namespace": "validate",
"line_last": 39,
"text": "--- Validate colour\n-- @param\tcolour\tstring\tThe colour to validate.\n-- @returns\t\t\tboolean\tTrue if the colour is valid, false otherwise.\nvalidate.colour = function(colour)",
"params": [
{
"directive": "param",
"text": "colour\tstring\tThe colour to validate.",
"name": "colour",
"type": "string",
"description": "The colour to validate."
}
],
"returns": {
"directive": "returns",
"text": "boolean\tTrue if the colour is valid, false otherwise.",
"type": "boolean",
"description": "True if the colour is valid, false otherwise."
},
"examples": [],
"name_full": "validate.undefined",
"filename": "worldeditadditions_core/utils/notify/validate.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/validate.lua#L37-L40"
}
🔗
Validate all
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to validate. |
message | string | nil | The message to validate. |
colour | string | nil | The colour to validate. |
Returns
boolean, table|nil
:
Returns the validation status, followed by details of the failure if bool == false.
Return arg | Meaning |
---|---|
boolean | True if all parameters are valid, false otherwise. |
`table | nil` |
Source
--- Validate all
-- @param name string The name of the player to validate.
-- @param message string The message to validate.
-- @param colour string The colour to validate.
-- @returns boolean, table|nil Returns the validation status, followed by details of the failure if bool == false.
-- | Return arg | Meaning |
-- |------------|---------|
-- | `boolean` | True if all parameters are valid, false otherwise. |
-- | `table|nil` | A table containing the fail state of the parameters or nil if player name is invalid. |
validate.all = function(name, message, colour)
{
"type": "function",
"internal": false,
"description": "Validate all",
"directives": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to validate.",
"name": "name",
"type": "string",
"description": "The name of the player to validate."
},
{
"directive": "param",
"text": "message\tstring\t\tThe message to validate.",
"name": "message",
"type": "string",
"description": "The message to validate."
},
{
"directive": "param",
"text": "colour\tstring\t\tThe colour to validate.",
"name": "colour",
"type": "string",
"description": "The colour to validate."
},
{
"directive": "returns",
"text": "boolean, table|nil\tReturns the validation status, followed by details of the failure if bool == false.\n| Return arg | Meaning |\n|------------|---------|\n| `boolean` | True if all parameters are valid, false otherwise. |\n| `table|nil` | A table containing the fail state of the parameters or nil if player name is invalid. |",
"type": "boolean, table|nil",
"description": "Returns the validation status, followed by details of the failure if bool == false.\n| Return arg | Meaning |\n|------------|---------|\n| `boolean` | True if all parameters are valid, false otherwise. |\n| `table|nil` | A table containing the fail state of the parameters or nil if player name is invalid. |"
}
],
"line": 45,
"namespace": "validate",
"line_last": 54,
"text": "--- Validate all\n-- @param\tname\tstring\t\tThe name of the player to validate.\n-- @param\tmessage\tstring\t\tThe message to validate.\n-- @param\tcolour\tstring\t\tThe colour to validate.\n-- @returns\tboolean, table|nil\tReturns the validation status, followed by details of the failure if bool == false.\n-- | Return arg | Meaning |\n-- |------------|---------|\n-- | `boolean` | True if all parameters are valid, false otherwise. |\n-- | `table|nil` | A table containing the fail state of the parameters or nil if player name is invalid. |\nvalidate.all = function(name, message, colour)",
"params": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to validate.",
"name": "name",
"type": "string",
"description": "The name of the player to validate."
},
{
"directive": "param",
"text": "message\tstring\t\tThe message to validate.",
"name": "message",
"type": "string",
"description": "The message to validate."
},
{
"directive": "param",
"text": "colour\tstring\t\tThe colour to validate.",
"name": "colour",
"type": "string",
"description": "The colour to validate."
}
],
"returns": {
"directive": "returns",
"text": "boolean, table|nil\tReturns the validation status, followed by details of the failure if bool == false.\n| Return arg | Meaning |\n|------------|---------|\n| `boolean` | True if all parameters are valid, false otherwise. |\n| `table|nil` | A table containing the fail state of the parameters or nil if player name is invalid. |",
"type": "boolean, table|nil",
"description": "Returns the validation status, followed by details of the failure if bool == false.\n| Return arg | Meaning |\n|------------|---------|\n| `boolean` | True if all parameters are valid, false otherwise. |\n| `table|nil` | A table containing the fail state of the parameters or nil if player name is invalid. |"
},
"examples": [],
"name_full": "validate.undefined",
"filename": "worldeditadditions_core/utils/notify/validate.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/validate.lua#L46-L55"
}
worldeditadditions 🔗
WorldEditAdditions Lua API
This is the documentation for the Lua API of WorldEditAdditions. It was generated automatically from comments spread across the codebase with moondoc.
You can save this documentation to your local device by pressing Ctrl + S on your keyboard.
Current version: 1.15-dev
These docs are a work-in-progress. Not all functions are documented here yet. If anything is unclear, please open an issue.
© 2023 Starbeamrainbowlabs and contributors. Licenced under the Mozilla Public License 2.0.
noise 🔗
System to manipulate the world using noise generation functions.
engines 🔗
Noise generation algorithm engines.
Perlin 🔗
Perlin noise generation engine. Original code by Ken Perlin: http://mrl.nyu.edu/~perlin/noise/ Port from this StackOverflow answer: https://stackoverflow.com/a/33425812/1460422
Functions
new 🔗
Creates a new Perlin instance.
Arguments
This function takes no arguments.
Returns
Perlin
:
A new perlin instance.
Source
--- Creates a new Perlin instance.
-- @return Perlin A new perlin instance.
function Perlin.new()
{
"type": "function",
"internal": false,
"description": "Creates a new Perlin instance.",
"directives": [
{
"directive": "returns",
"text": "Perlin\tA new perlin instance.",
"type": "Perlin",
"description": "A new perlin instance."
}
],
"line": 35,
"namespace": "worldeditadditions.noise.engines.Perlin",
"line_last": 37,
"name": "new",
"instanced": false,
"args": [
""
],
"text": "--- Creates a new Perlin instance.\n-- @return\tPerlin\tA new perlin instance.\nfunction Perlin.new()",
"params": [],
"returns": {
"directive": "returns",
"text": "Perlin\tA new perlin instance.",
"type": "Perlin",
"description": "A new perlin instance."
},
"examples": [],
"name_full": "worldeditadditions.noise.engines.Perlin.new",
"filename": "worldeditadditions/lib/noise/engines/perlin.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/noise/engines/perlin.lua#L36-L38"
}
noise 🔗
Returns a noise value for a given point in 3D space.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
x | number | nil | The x co-ordinate. |
y | number | nil | The y co-ordinate. |
z | number | nil | The z co-ordinate. |
Returns
number
:
The calculated noise value.
Source
--- Returns a noise value for a given point in 3D space.
-- @param x number The x co-ordinate.
-- @param y number The y co-ordinate.
-- @param z number The z co-ordinate.
-- @returns number The calculated noise value.
function Perlin:noise( x, y, z )
{
"type": "function",
"internal": false,
"description": "Returns a noise value for a given point in 3D space.",
"directives": [
{
"directive": "param",
"text": "x\tnumber\tThe x co-ordinate.",
"name": "x",
"type": "number",
"description": "The x co-ordinate."
},
{
"directive": "param",
"text": "y\tnumber\tThe y co-ordinate.",
"name": "y",
"type": "number",
"description": "The y co-ordinate."
},
{
"directive": "param",
"text": "z\tnumber\tThe z co-ordinate.",
"name": "z",
"type": "number",
"description": "The z co-ordinate."
},
{
"directive": "returns",
"text": "number\t\tThe calculated noise value.",
"type": "number",
"description": "The calculated noise value."
}
],
"line": 54,
"namespace": "worldeditadditions.noise.engines.Perlin",
"line_last": 59,
"name": "noise",
"instanced": true,
"args": [
" x",
"y",
"z "
],
"text": "--- Returns a noise value for a given point in 3D space.\n-- @param\tx\tnumber\tThe x co-ordinate.\n-- @param\ty\tnumber\tThe y co-ordinate.\n-- @param\tz\tnumber\tThe z co-ordinate.\n-- @returns\tnumber\t\tThe calculated noise value.\nfunction Perlin:noise( x, y, z )",
"params": [
{
"directive": "param",
"text": "x\tnumber\tThe x co-ordinate.",
"name": "x",
"type": "number",
"description": "The x co-ordinate."
},
{
"directive": "param",
"text": "y\tnumber\tThe y co-ordinate.",
"name": "y",
"type": "number",
"description": "The y co-ordinate."
},
{
"directive": "param",
"text": "z\tnumber\tThe z co-ordinate.",
"name": "z",
"type": "number",
"description": "The z co-ordinate."
}
],
"returns": {
"directive": "returns",
"text": "number\t\tThe calculated noise value.",
"type": "number",
"description": "The calculated noise value."
},
"examples": [],
"name_full": "worldeditadditions.noise.engines.Perlin.noise",
"filename": "worldeditadditions/lib/noise/engines/perlin.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/noise/engines/perlin.lua#L55-L60"
}
sculpt 🔗
Sculpting brush engine.
brushes 🔗
Brushes for use with the sculpting system. Dump your own in the directory worldeditadditions/lib/sculpt/brushes
(relative to the WorldEditAdditions git repository root), and WorldEditAdditions will automatically read them!
See the documentation for more information: <https://worldeditadditions.mooncarrot.space/Reference/#sculpt>
Functions
circle 🔗
Makes a circle brush of a given size. Default inbuilt brush.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
size | Vector3 | nil | The desired sizez of the brush (only X and Y are considered; Z is ignored). |
Returns
bool,brush,Vector3
:
Success bool, then the brush, then finally the actual size of the brush generated.
Source
--- Makes a circle brush of a given size.
-- Default inbuilt brush.
-- @name circle
-- @param size Vector3 The desired sizez of the brush (only X and Y are considered; Z is ignored).
-- @returns bool,brush,Vector3 Success bool, then the brush, then finally the actual size of the brush generated.
return function(size)
{
"type": "function",
"internal": false,
"description": "Makes a circle brush of a given size.\nDefault inbuilt brush.",
"directives": [
{
"directive": "name",
"text": "circle"
},
{
"directive": "param",
"text": "size\tVector3\t\tThe desired sizez of the brush (only X and Y are considered; Z is ignored).",
"name": "size",
"type": "Vector3",
"description": "The desired sizez of the brush (only X and Y are considered; Z is ignored)."
},
{
"directive": "returns",
"text": "bool,brush,Vector3\tSuccess bool, then the brush, then finally the actual size of the brush generated.",
"type": "bool,brush,Vector3",
"description": "Success bool, then the brush, then finally the actual size of the brush generated."
}
],
"line": 6,
"namespace": "worldeditadditions.sculpt.brushes",
"line_last": 11,
"name": "circle",
"instanced": false,
"args": [
"size"
],
"text": "--- Makes a circle brush of a given size.\n-- Default inbuilt brush.\n-- @name\tcircle\n-- @param\tsize\tVector3\t\tThe desired sizez of the brush (only X and Y are considered; Z is ignored).\n-- @returns\tbool,brush,Vector3\tSuccess bool, then the brush, then finally the actual size of the brush generated.\nreturn function(size)",
"params": [
{
"directive": "param",
"text": "size\tVector3\t\tThe desired sizez of the brush (only X and Y are considered; Z is ignored).",
"name": "size",
"type": "Vector3",
"description": "The desired sizez of the brush (only X and Y are considered; Z is ignored)."
}
],
"returns": {
"directive": "returns",
"text": "bool,brush,Vector3\tSuccess bool, then the brush, then finally the actual size of the brush generated.",
"type": "bool,brush,Vector3",
"description": "Success bool, then the brush, then finally the actual size of the brush generated."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.brushes.circle",
"filename": "worldeditadditions/lib/sculpt/brushes/circle.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/brushes/circle.lua#L7-L12"
}
make_gaussian 🔗
Returns a smooth gaussian brush.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
size | Vector3 | nil | The target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations. |
sigma | number | 2 | The 'smoothness' of the brush. Higher values are more smooth. |
Returns
nil
Source
--- Returns a smooth gaussian brush.
-- @name make_gaussian
-- @internal
-- @param size Vector3 The target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations.
-- @param sigma=2 number The 'smoothness' of the brush. Higher values are more smooth.
return function(size, sigma)
{
"type": "function",
"internal": true,
"description": "Returns a smooth gaussian brush.",
"directives": [
{
"directive": "name",
"text": "make_gaussian"
},
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "size\tVector3\t\tThe target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations.",
"name": "size",
"type": "Vector3",
"description": "The target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations."
},
{
"directive": "param",
"text": "sigma=2\tnumber\t\tThe 'smoothness' of the brush. Higher values are more smooth.",
"name": "sigma",
"type": "number",
"description": "The 'smoothness' of the brush. Higher values are more smooth.",
"default_value": "2"
}
],
"line": 7,
"namespace": "worldeditadditions.sculpt.brushes",
"line_last": 12,
"name": "make_gaussian",
"instanced": false,
"args": [
"size",
"sigma"
],
"text": "--- Returns a smooth gaussian brush.\n-- @name make_gaussian\n-- @internal\n-- @param\tsize\tVector3\t\tThe target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations.\n-- @param\tsigma=2\tnumber\t\tThe 'smoothness' of the brush. Higher values are more smooth.\nreturn function(size, sigma)",
"params": [
{
"directive": "param",
"text": "size\tVector3\t\tThe target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations.",
"name": "size",
"type": "Vector3",
"description": "The target size of the brush. Note that the actual size of the brush will be different, as the gaussian function has some limitations."
},
{
"directive": "param",
"text": "sigma=2\tnumber\t\tThe 'smoothness' of the brush. Higher values are more smooth.",
"name": "sigma",
"type": "number",
"description": "The 'smoothness' of the brush. Higher values are more smooth.",
"default_value": "2"
}
],
"examples": [],
"name_full": "worldeditadditions.sculpt.brushes.make_gaussian",
"filename": "worldeditadditions/lib/sculpt/brushes/__gaussian.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/brushes/__gaussian.lua#L8-L13"
}
square 🔗
Returns a simple square brush with 100% weight for every pixel. Default inbuilt brush.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
size | Vector3 | nil | The desired size of the brush. Only the x and y components are used; the z component is ignored. |
Returns
bool,number[],Vector3
:
1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components.
Source
--- Returns a simple square brush with 100% weight for every pixel.
-- Default inbuilt brush.
-- @name square
-- @param size Vector3 The desired size of the brush. Only the x and y components are used; the z component is ignored.
-- @returns bool,number[],Vector3 1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components.
return function(size)
{
"type": "function",
"internal": false,
"description": "Returns a simple square brush with 100% weight for every pixel.\nDefault inbuilt brush.",
"directives": [
{
"directive": "name",
"text": "square"
},
{
"directive": "param",
"text": "size\t\tVector3\t\tThe desired size of the brush. Only the x and y components are used; the z component is ignored.",
"name": "size",
"type": "Vector3",
"description": "The desired size of the brush. Only the x and y components are used; the z component is ignored."
},
{
"directive": "returns",
"text": "bool,number[],Vector3\t1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components.",
"type": "bool,number[],Vector3",
"description": "1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components."
}
],
"line": 3,
"namespace": "worldeditadditions.sculpt.brushes",
"line_last": 8,
"name": "square",
"instanced": false,
"args": [
"size"
],
"text": "--- Returns a simple square brush with 100% weight for every pixel.\n-- Default inbuilt brush.\n-- @name square\n-- @param\tsize\t\tVector3\t\tThe desired size of the brush. Only the x and y components are used; the z component is ignored.\n-- @returns bool,number[],Vector3\t1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components.\nreturn function(size)",
"params": [
{
"directive": "param",
"text": "size\t\tVector3\t\tThe desired size of the brush. Only the x and y components are used; the z component is ignored.",
"name": "size",
"type": "Vector3",
"description": "The desired size of the brush. Only the x and y components are used; the z component is ignored."
}
],
"returns": {
"directive": "returns",
"text": "bool,number[],Vector3\t1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components.",
"type": "bool,number[],Vector3",
"description": "1: true, as this function always succeeds. 2: A simple square brush as a zero-indexed flat array. 3: The size of the resulting brush as a Vector3, using the x and y components."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.brushes.square",
"filename": "worldeditadditions/lib/sculpt/brushes/square.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/brushes/square.lua#L4-L9"
}
Functions
apply 🔗
Applies the given brush with the given height and size to the given position.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The position at which to apply the brush. |
brush_name | string | nil | The name of the brush to apply. |
brush_size | Vector3 | nil | The size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z! |
height | number | nil | The height of the brush application. |
Returns
bool, string|{ added: number, removed: number }
:
A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).
Source
--- Applies the given brush with the given height and size to the given position.
-- @param pos1 Vector3 The position at which to apply the brush.
-- @param brush_name string The name of the brush to apply.
-- @param brush_size Vector3 The size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z!
-- @param height number The height of the brush application.
-- @returns bool, string|{ added: number, removed: number } A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).
local function apply(pos1, brush_name, brush_size, height)
{
"type": "function",
"internal": false,
"description": "Applies the given brush with the given height and size to the given position.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe position at which to apply the brush.",
"name": "pos1",
"type": "Vector3",
"description": "The position at which to apply the brush."
},
{
"directive": "param",
"text": "brush_name\tstring\t\tThe name of the brush to apply.",
"name": "brush_name",
"type": "string",
"description": "The name of the brush to apply."
},
{
"directive": "param",
"text": "brush_size\tVector3\t\tThe size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z!",
"name": "brush_size",
"type": "Vector3",
"description": "The size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z!"
},
{
"directive": "param",
"text": "height\t\tnumber\t\tThe height of the brush application.",
"name": "height",
"type": "number",
"description": "The height of the brush application."
},
{
"directive": "returns",
"text": "bool, string|{ added: number, removed: number }\tA bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).",
"type": "bool, string|{ added: number, removed: number }",
"description": "A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful)."
}
],
"line": 7,
"namespace": "worldeditadditions.sculpt",
"line_last": 13,
"name": "apply",
"instanced": false,
"args": [
"pos1",
"brush_name",
"brush_size",
"height"
],
"text": "--- Applies the given brush with the given height and size to the given position.\n-- @param\tpos1\t\tVector3\t\tThe position at which to apply the brush.\n-- @param\tbrush_name\tstring\t\tThe name of the brush to apply.\n-- @param\tbrush_size\tVector3\t\tThe size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z!\n-- @param\theight\t\tnumber\t\tThe height of the brush application.\n-- @returns\tbool, string|{ added: number, removed: number }\tA bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).\nlocal function apply(pos1, brush_name, brush_size, height)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe position at which to apply the brush.",
"name": "pos1",
"type": "Vector3",
"description": "The position at which to apply the brush."
},
{
"directive": "param",
"text": "brush_name\tstring\t\tThe name of the brush to apply.",
"name": "brush_name",
"type": "string",
"description": "The name of the brush to apply."
},
{
"directive": "param",
"text": "brush_size\tVector3\t\tThe size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z!",
"name": "brush_size",
"type": "Vector3",
"description": "The size of the brush application. Values are interpreted on the X/Y coordinates, and NOT X/Z!"
},
{
"directive": "param",
"text": "height\t\tnumber\t\tThe height of the brush application.",
"name": "height",
"type": "number",
"description": "The height of the brush application."
}
],
"returns": {
"directive": "returns",
"text": "bool, string|{ added: number, removed: number }\tA bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).",
"type": "bool, string|{ added: number, removed: number }",
"description": "A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful)."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.apply",
"filename": "worldeditadditions/lib/sculpt/apply.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/apply.lua#L8-L14"
}
apply_heightmap 🔗
Applies the given brush at the given x/z position to the given heightmap. Important: Where a Vector3 is mentioned in the parameter list, it reall MUST be a Vector3 instance. Also important: Remember that the position there is RELATIVE TO THE HEIGHTMAP'S origin (0, 0) and is on the X and Z axes!
Arguments
Name | Type | Default value | Description |
---|---|---|---|
brush | table | nil | The ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1. |
brush_size | Vector3 | nil | The size of the brush on the x/y axes. |
position | Vector3 | nil | The position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on. |
heightmap | table | nil | The heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these. |
heightmap_size | Vector3 | nil | The size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information. |
Returns
true,number,number|false,string
:
If the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed.
Source
--- Applies the given brush at the given x/z position to the given heightmap.
-- Important: Where a Vector3 is mentioned in the parameter list, it reall MUST
-- be a Vector3 instance.
-- Also important: Remember that the position there is RELATIVE TO THE HEIGHTMAP'S origin (0, 0) and is on the X and Z axes!
-- @param brush table The ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1.
-- @param brush_size Vector3 The size of the brush on the x/y axes.
-- @pram height number The multiplier to apply to each brush pixel value just before applying it. Negative values are allowed - this will cause a subtraction operation instead of an addition.
-- @param position Vector3 The position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on.
-- @param heightmap table The heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these.
-- @param heightmap_size Vector3 The size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information.
-- @returns true,number,number|false,string If the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed.
local function apply_heightmap(brush, brush_size, height, position, heightmap, heightmap_size)
{
"type": "function",
"internal": false,
"description": "Applies the given brush at the given x/z position to the given heightmap.\nImportant: Where a Vector3 is mentioned in the parameter list, it reall MUST\nbe a Vector3 instance.\nAlso important: Remember that the position there is RELATIVE TO THE HEIGHTMAP'S origin (0, 0) and is on the X and Z axes!",
"directives": [
{
"directive": "param",
"text": "brush\t\t\ttable\tThe ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1.",
"name": "brush",
"type": "table",
"description": "The ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1."
},
{
"directive": "param",
"text": "brush_size\t\tVector3\tThe size of the brush on the x/y axes.",
"name": "brush_size",
"type": "Vector3",
"description": "The size of the brush on the x/y axes."
},
{
"directive": "pram",
"text": "height\t\t\tnumber\tThe multiplier to apply to each brush pixel value just before applying it. Negative values are allowed - this will cause a subtraction operation instead of an addition."
},
{
"directive": "param",
"text": "position\t\tVector3\tThe position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on.",
"name": "position",
"type": "Vector3",
"description": "The position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on."
},
{
"directive": "param",
"text": "heightmap\t\ttable\tThe heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these.",
"name": "heightmap",
"type": "table",
"description": "The heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these."
},
{
"directive": "param",
"text": "heightmap_size\tVector3\tThe size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information.",
"name": "heightmap_size",
"type": "Vector3",
"description": "The size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information."
},
{
"directive": "returns",
"text": "true,number,number|false,string\t\tIf the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed.",
"type": "true,number,number|false,string",
"description": "If the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed."
}
],
"line": 7,
"namespace": "worldeditadditions.sculpt",
"line_last": 18,
"name": "apply_heightmap",
"instanced": false,
"args": [
"brush",
"brush_size",
"height",
"position",
"heightmap",
"heightmap_size"
],
"text": "--- Applies the given brush at the given x/z position to the given heightmap.\n-- Important: Where a Vector3 is mentioned in the parameter list, it reall MUST\n-- be a Vector3 instance.\n-- Also important: Remember that the position there is RELATIVE TO THE HEIGHTMAP'S origin (0, 0) and is on the X and Z axes!\n-- @param\tbrush\t\t\ttable\tThe ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1.\n-- @param\tbrush_size\t\tVector3\tThe size of the brush on the x/y axes.\n-- @pram\theight\t\t\tnumber\tThe multiplier to apply to each brush pixel value just before applying it. Negative values are allowed - this will cause a subtraction operation instead of an addition.\n-- @param\tposition\t\tVector3\tThe position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on.\n-- @param\theightmap\t\ttable\tThe heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these.\n-- @param\theightmap_size\tVector3\tThe size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information.\n-- @returns\ttrue,number,number|false,string\t\tIf the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed.\nlocal function apply_heightmap(brush, brush_size, height, position, heightmap, heightmap_size)",
"params": [
{
"directive": "param",
"text": "brush\t\t\ttable\tThe ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1.",
"name": "brush",
"type": "table",
"description": "The ZERO-indexed brush to apply. Values should be normalised to be between 0 and 1."
},
{
"directive": "param",
"text": "brush_size\t\tVector3\tThe size of the brush on the x/y axes.",
"name": "brush_size",
"type": "Vector3",
"description": "The size of the brush on the x/y axes."
},
{
"directive": "param",
"text": "position\t\tVector3\tThe position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on.",
"name": "position",
"type": "Vector3",
"description": "The position RELATIVE TO THE HEIGHTMAP on the x/z coordinates to centre the brush application on."
},
{
"directive": "param",
"text": "heightmap\t\ttable\tThe heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these.",
"name": "heightmap",
"type": "table",
"description": "The heightmap to apply the brush to. See worldeditadditions.make_heightmap for how to obtain one of these."
},
{
"directive": "param",
"text": "heightmap_size\tVector3\tThe size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information.",
"name": "heightmap_size",
"type": "Vector3",
"description": "The size of the aforementioned heightmap. See worldeditadditions.make_heightmap for more information."
}
],
"returns": {
"directive": "returns",
"text": "true,number,number|false,string\t\tIf the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed.",
"type": "true,number,number|false,string",
"description": "If the operation was not successful, then false followed by an error message as a string is returned. If it was successful however, 3 values are returned: true, then the number of nodes added, then the number of nodes removed."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.apply_heightmap",
"filename": "worldeditadditions/lib/sculpt/apply_heightmap.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/apply_heightmap.lua#L8-L19"
}
import_static 🔗
Reads and parses the brush stored in the specified file.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
filepath | string | nil | The path to file that contains the static brush to read in. |
Returns
true,table,Vector3|false,string
:
A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)
Source
--- Reads and parses the brush stored in the specified file.
-- @name import_static
-- @internal
-- @param filepath string The path to file that contains the static brush to read in.
-- @returns true,table,Vector3|false,string A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)
return function(filepath)
{
"type": "function",
"internal": true,
"description": "Reads and parses the brush stored in the specified file.",
"directives": [
{
"directive": "name",
"text": "import_static"
},
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "filepath\tstring\t\tThe path to file that contains the static brush to read in.",
"name": "filepath",
"type": "string",
"description": "The path to file that contains the static brush to read in."
},
{
"directive": "returns",
"text": "true,table,Vector3|false,string\t\tA success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)",
"type": "true,table,Vector3|false,string",
"description": "A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)"
}
],
"line": 7,
"namespace": "worldeditadditions.sculpt",
"line_last": 12,
"name": "import_static",
"instanced": false,
"args": [
"filepath"
],
"text": "--- Reads and parses the brush stored in the specified file.\n-- @name import_static\n-- @internal\n-- @param\tfilepath\tstring\t\tThe path to file that contains the static brush to read in.\n-- @returns\ttrue,table,Vector3|false,string\t\tA success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)\nreturn function(filepath)",
"params": [
{
"directive": "param",
"text": "filepath\tstring\t\tThe path to file that contains the static brush to read in.",
"name": "filepath",
"type": "string",
"description": "The path to file that contains the static brush to read in."
}
],
"returns": {
"directive": "returns",
"text": "true,table,Vector3|false,string\t\tA success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)",
"type": "true,table,Vector3|false,string",
"description": "A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)"
},
"examples": [],
"name_full": "worldeditadditions.sculpt.import_static",
"filename": "worldeditadditions/lib/sculpt/import_static.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/import_static.lua#L8-L13"
}
make_brush 🔗
Makes a sculpting brush that is as close to a target size as possible.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
brush_name | string | nil | The name of the brush to create. |
target_size | Vector3 | nil | The target size of the brush to create. |
Returns
true,table,Vector3|false,string
:
If the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead.
Source
--- Makes a sculpting brush that is as close to a target size as possible.
-- @param brush_name string The name of the brush to create.
-- @param target_size Vector3 The target size of the brush to create.
-- @returns true,table,Vector3|false,string If the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead.
local function make_brush(brush_name, target_size)
{
"type": "function",
"internal": false,
"description": "Makes a sculpting brush that is as close to a target size as possible.",
"directives": [
{
"directive": "param",
"text": "brush_name\tstring\tThe name of the brush to create.",
"name": "brush_name",
"type": "string",
"description": "The name of the brush to create."
},
{
"directive": "param",
"text": "target_size\tVector3\tThe target size of the brush to create.",
"name": "target_size",
"type": "Vector3",
"description": "The target size of the brush to create."
},
{
"directive": "returns",
"text": "true,table,Vector3|false,string\tIf the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead.",
"type": "true,table,Vector3|false,string",
"description": "If the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead."
}
],
"line": 5,
"namespace": "worldeditadditions.sculpt",
"line_last": 9,
"name": "make_brush",
"instanced": false,
"args": [
"brush_name",
"target_size"
],
"text": "--- Makes a sculpting brush that is as close to a target size as possible.\n-- @param\tbrush_name\tstring\tThe name of the brush to create.\n-- @param\ttarget_size\tVector3\tThe target size of the brush to create.\n-- @returns\ttrue,table,Vector3|false,string\tIf the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead.\nlocal function make_brush(brush_name, target_size)",
"params": [
{
"directive": "param",
"text": "brush_name\tstring\tThe name of the brush to create.",
"name": "brush_name",
"type": "string",
"description": "The name of the brush to create."
},
{
"directive": "param",
"text": "target_size\tVector3\tThe target size of the brush to create.",
"name": "target_size",
"type": "Vector3",
"description": "The target size of the brush to create."
}
],
"returns": {
"directive": "returns",
"text": "true,table,Vector3|false,string\tIf the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead.",
"type": "true,table,Vector3|false,string",
"description": "If the operation was successful, true followed by the brush in a 1D ZERO-indexed table followed by the actual size of the brush as a Vector3 (x & y components used only). If the operation was not successful, false and an error message string is returned instead."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.make_brush",
"filename": "worldeditadditions/lib/sculpt/make_brush.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/make_brush.lua#L6-L10"
}
make_preview 🔗
Generates a textual preview of a given brush.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
brush | table | nil | The brush in question to preview. |
size | Vector3 | nil | The size of the brush. |
Returns
string
:
A preview of the brush as a string.
Source
--- Generates a textual preview of a given brush.
-- @param brush table The brush in question to preview.
-- @param size Vector3 The size of the brush.
-- @returns string A preview of the brush as a string.
local function make_preview(brush, size, framed)
{
"type": "function",
"internal": false,
"description": "Generates a textual preview of a given brush.",
"directives": [
{
"directive": "param",
"text": "brush\t\ttable\tThe brush in question to preview.",
"name": "brush",
"type": "table",
"description": "The brush in question to preview."
},
{
"directive": "param",
"text": "size\t\tVector3\tThe size of the brush.",
"name": "size",
"type": "Vector3",
"description": "The size of the brush."
},
{
"directive": "returns",
"text": "string\t\tA preview of the brush as a string.",
"type": "string",
"description": "A preview of the brush as a string."
}
],
"line": 7,
"namespace": "worldeditadditions.sculpt",
"line_last": 11,
"name": "make_preview",
"instanced": false,
"args": [
"brush",
"size",
"framed"
],
"text": "--- Generates a textual preview of a given brush.\n-- @param\tbrush\t\ttable\tThe brush in question to preview.\n-- @param\tsize\t\tVector3\tThe size of the brush.\n-- @returns\tstring\t\tA preview of the brush as a string.\nlocal function make_preview(brush, size, framed)",
"params": [
{
"directive": "param",
"text": "brush\t\ttable\tThe brush in question to preview.",
"name": "brush",
"type": "table",
"description": "The brush in question to preview."
},
{
"directive": "param",
"text": "size\t\tVector3\tThe size of the brush.",
"name": "size",
"type": "Vector3",
"description": "The size of the brush."
}
],
"returns": {
"directive": "returns",
"text": "string\t\tA preview of the brush as a string.",
"type": "string",
"description": "A preview of the brush as a string."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.make_preview",
"filename": "worldeditadditions/lib/sculpt/make_preview.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/make_preview.lua#L8-L12"
}
parse_static 🔗
Parses a static brush definition.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source | string | nil | The source string that contains the static brush, formatted as TSV. |
Returns
true,table,Vector3|false,string
:
A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)
Source
--- Parses a static brush definition.
-- @name parse_static
-- @internal
-- @param source string The source string that contains the static brush, formatted as TSV.
-- @returns true,table,Vector3|false,string A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)
return function(source)
{
"type": "function",
"internal": true,
"description": "Parses a static brush definition.",
"directives": [
{
"directive": "name",
"text": "parse_static"
},
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "source\tstring\tThe source string that contains the static brush, formatted as TSV.",
"name": "source",
"type": "string",
"description": "The source string that contains the static brush, formatted as TSV."
},
{
"directive": "returns",
"text": "true,table,Vector3|false,string\t\tA success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)",
"type": "true,table,Vector3|false,string",
"description": "A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)"
}
],
"line": 7,
"namespace": "worldeditadditions.sculpt",
"line_last": 12,
"name": "parse_static",
"instanced": false,
"args": [
"source"
],
"text": "--- Parses a static brush definition.\n-- @name parse_static\n-- @internal\n-- @param\tsource\tstring\tThe source string that contains the static brush, formatted as TSV.\n-- @returns\ttrue,table,Vector3|false,string\t\tA success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)\nreturn function(source)",
"params": [
{
"directive": "param",
"text": "source\tstring\tThe source string that contains the static brush, formatted as TSV.",
"name": "source",
"type": "string",
"description": "The source string that contains the static brush, formatted as TSV."
}
],
"returns": {
"directive": "returns",
"text": "true,table,Vector3|false,string\t\tA success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)",
"type": "true,table,Vector3|false,string",
"description": "A success boolean, followed either by an error message as a string or the brush (as a table) and it's size (as an X/Y Vector3)"
},
"examples": [],
"name_full": "worldeditadditions.sculpt.parse_static",
"filename": "worldeditadditions/lib/sculpt/parse_static.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/parse_static.lua#L8-L13"
}
preview_brush 🔗
Generates a textual preview of a given brush.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
brush_name | string | nil | The name of the brush to create a preview for. |
target_size | Vector3 | nil | The target size of the brush to create. Default: (10, 10, 0). |
Returns
bool,string
:
If the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead.
Source
--- Generates a textual preview of a given brush.
-- @param brush_name string The name of the brush to create a preview for.
-- @param target_size Vector3 The target size of the brush to create. Default: (10, 10, 0).
-- @returns bool,string If the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead.
local function preview_brush(brush_name, target_size, framed)
{
"type": "function",
"internal": false,
"description": "Generates a textual preview of a given brush.",
"directives": [
{
"directive": "param",
"text": "brush_name\tstring\tThe name of the brush to create a preview for.",
"name": "brush_name",
"type": "string",
"description": "The name of the brush to create a preview for."
},
{
"directive": "param",
"text": "target_size\tVector3\tThe target size of the brush to create. Default: (10, 10, 0).",
"name": "target_size",
"type": "Vector3",
"description": "The target size of the brush to create. Default: (10, 10, 0)."
},
{
"directive": "returns",
"text": "bool,string\tIf the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead.",
"type": "bool,string",
"description": "If the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead."
}
],
"line": 10,
"namespace": "worldeditadditions.sculpt",
"line_last": 14,
"name": "preview_brush",
"instanced": false,
"args": [
"brush_name",
"target_size",
"framed"
],
"text": "--- Generates a textual preview of a given brush.\n-- @param\tbrush_name\tstring\tThe name of the brush to create a preview for.\n-- @param\ttarget_size\tVector3\tThe target size of the brush to create. Default: (10, 10, 0).\n-- @returns\tbool,string\tIf the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead.\nlocal function preview_brush(brush_name, target_size, framed)",
"params": [
{
"directive": "param",
"text": "brush_name\tstring\tThe name of the brush to create a preview for.",
"name": "brush_name",
"type": "string",
"description": "The name of the brush to create a preview for."
},
{
"directive": "param",
"text": "target_size\tVector3\tThe target size of the brush to create. Default: (10, 10, 0).",
"name": "target_size",
"type": "Vector3",
"description": "The target size of the brush to create. Default: (10, 10, 0)."
}
],
"returns": {
"directive": "returns",
"text": "bool,string\tIf the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead.",
"type": "bool,string",
"description": "If the operation was successful, true followed by a preview of the brush as a string. If the operation was not successful, false and an error message string is returned instead."
},
"examples": [],
"name_full": "worldeditadditions.sculpt.preview_brush",
"filename": "worldeditadditions/lib/sculpt/preview_brush.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/preview_brush.lua#L11-L15"
}
scan_static 🔗
Scans the given directory and imports all static brushes found. Static brushes have the file extension ".brush.tsv" (without quotes).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
dirpath | string | nil | The path to directory that contains the static brushs to import. |
Returns
bool,loaded,errors
:
A success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)
Source
--- Scans the given directory and imports all static brushes found.
-- Static brushes have the file extension ".brush.tsv" (without quotes).
-- @name scan_static
-- @internal
-- @param dirpath string The path to directory that contains the static brushs to import.
-- @returns bool,loaded,errors A success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)
return function(dirpath, overwrite_existing)
{
"type": "function",
"internal": true,
"description": "Scans the given directory and imports all static brushes found.\nStatic brushes have the file extension \".brush.tsv\" (without quotes).",
"directives": [
{
"directive": "name",
"text": "scan_static"
},
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "dirpath\tstring\t\tThe path to directory that contains the static brushs to import.",
"name": "dirpath",
"type": "string",
"description": "The path to directory that contains the static brushs to import."
},
{
"directive": "returns",
"text": "bool,loaded,errors\tA success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)",
"type": "bool,loaded,errors",
"description": "A success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)"
}
],
"line": 26,
"namespace": "worldeditadditions.sculpt",
"line_last": 32,
"name": "scan_static",
"instanced": false,
"args": [
"dirpath",
"overwrite_existing"
],
"text": "--- Scans the given directory and imports all static brushes found.\n-- Static brushes have the file extension \".brush.tsv\" (without quotes).\n-- @name\tscan_static\n-- @internal\n-- @param\tdirpath\tstring\t\tThe path to directory that contains the static brushs to import.\n-- @returns\tbool,loaded,errors\tA success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)\nreturn function(dirpath, overwrite_existing)",
"params": [
{
"directive": "param",
"text": "dirpath\tstring\t\tThe path to directory that contains the static brushs to import.",
"name": "dirpath",
"type": "string",
"description": "The path to directory that contains the static brushs to import."
}
],
"returns": {
"directive": "returns",
"text": "bool,loaded,errors\tA success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)",
"type": "bool,loaded,errors",
"description": "A success boolean, followed by the number of brushes loaded, followed by the number of errors encountered while loading brushes (errors are logged as warnings with Minetest)"
},
"examples": [],
"name_full": "worldeditadditions.sculpt.scan_static",
"filename": "worldeditadditions/lib/sculpt/scan_static.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/sculpt/scan_static.lua#L27-L33"
}
selection 🔗
Functions for handling selections of the defined pos1/pos2 region.
These functions primarily back the cloud wand. To manipulate positions directly, see the worldeditadditions_core.pos
namespace.
Functions
add_point 🔗
Additively adds a point to the current selection defined by pos1..pos2 or makes a selection from the provided point.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | Player name. |
pos | vector | nil | The position to include. |
Returns
void
Source
--- Additively adds a point to the current selection defined by pos1..pos2 or
-- makes a selection from the provided point.
-- @param name string Player name.
-- @param pos vector The position to include.
-- @returns void
function selection.add_point(name, newpos)
{
"type": "function",
"internal": false,
"description": "Additively adds a point to the current selection defined by pos1..pos2 or\nmakes a selection from the provided point.",
"directives": [
{
"directive": "param",
"text": "name\tstring\tPlayer name.",
"name": "name",
"type": "string",
"description": "Player name."
},
{
"directive": "param",
"text": "pos\tvector\tThe position to include.",
"name": "pos",
"type": "vector",
"description": "The position to include."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 17,
"namespace": "worldeditadditions.selection",
"line_last": 22,
"name": "add_point",
"instanced": false,
"args": [
"name",
"newpos"
],
"text": "--- Additively adds a point to the current selection defined by pos1..pos2 or\n-- makes a selection from the provided point.\n-- @param\tname\tstring\tPlayer name.\n-- @param\tpos\tvector\tThe position to include.\n-- @returns\tvoid\nfunction selection.add_point(name, newpos)",
"params": [
{
"directive": "param",
"text": "name\tstring\tPlayer name.",
"name": "name",
"type": "string",
"description": "Player name."
},
{
"directive": "param",
"text": "pos\tvector\tThe position to include.",
"name": "pos",
"type": "vector",
"description": "The position to include."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions.selection.add_point",
"filename": "worldeditadditions/lib/selection/selection.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/selection/selection.lua#L18-L23"
}
check_axis 🔗
Checks if a string is a valid axis.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | String to check (be sure to remove any + or -). |
hv | bool | nil | Include "h" (general horizontal) and "v" (general vertical). |
Returns
bool
:
If string is a valid axis then true.
Source
--- Checks if a string is a valid axis.
-- @param str string String to check (be sure to remove any + or -).
-- @param hv bool Include "h" (general horizontal) and "v" (general vertical).
-- @return bool If string is a valid axis then true.
function selection.check_axis(str,hv)
{
"type": "function",
"internal": false,
"description": "Checks if a string is a valid axis.",
"directives": [
{
"directive": "param",
"text": "str\tstring\tString to check (be sure to remove any + or -).",
"name": "str",
"type": "string",
"description": "String to check (be sure to remove any + or -)."
},
{
"directive": "param",
"text": "hv\tbool\tInclude \"h\" (general horizontal) and \"v\" (general vertical).",
"name": "hv",
"type": "bool",
"description": "Include \"h\" (general horizontal) and \"v\" (general vertical)."
},
{
"directive": "returns",
"text": "bool\tIf string is a valid axis then true.",
"type": "bool",
"description": "If string is a valid axis then true."
}
],
"line": 81,
"namespace": "worldeditadditions.selection",
"line_last": 85,
"name": "check_axis",
"instanced": false,
"args": [
"str",
"hv"
],
"text": "--- Checks if a string is a valid axis.\n-- @param\tstr\tstring\tString to check (be sure to remove any + or -).\n-- @param\thv\tbool\tInclude \"h\" (general horizontal) and \"v\" (general vertical).\n-- @return\tbool\tIf string is a valid axis then true.\nfunction selection.check_axis(str,hv)",
"params": [
{
"directive": "param",
"text": "str\tstring\tString to check (be sure to remove any + or -).",
"name": "str",
"type": "string",
"description": "String to check (be sure to remove any + or -)."
},
{
"directive": "param",
"text": "hv\tbool\tInclude \"h\" (general horizontal) and \"v\" (general vertical).",
"name": "hv",
"type": "bool",
"description": "Include \"h\" (general horizontal) and \"v\" (general vertical)."
}
],
"returns": {
"directive": "returns",
"text": "bool\tIf string is a valid axis then true.",
"type": "bool",
"description": "If string is a valid axis then true."
},
"examples": [],
"name_full": "worldeditadditions.selection.check_axis",
"filename": "worldeditadditions/lib/selection/selection.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/selection/selection.lua#L82-L86"
}
check_dir 🔗
Checks if a string is a valid dir.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | String to check (be sure to remove any + or -). |
Returns
bool
:
If string is a valid dir then true.
Source
--- Checks if a string is a valid dir.
-- @param str string String to check (be sure to remove any + or -).
-- @return bool If string is a valid dir then true.
function selection.check_dir(str)
{
"type": "function",
"internal": false,
"description": "Checks if a string is a valid dir.",
"directives": [
{
"directive": "param",
"text": "str\tstring\tString to check (be sure to remove any + or -).",
"name": "str",
"type": "string",
"description": "String to check (be sure to remove any + or -)."
},
{
"directive": "returns",
"text": "bool\tIf string is a valid dir then true.",
"type": "bool",
"description": "If string is a valid dir then true."
}
],
"line": 93,
"namespace": "worldeditadditions.selection",
"line_last": 96,
"name": "check_dir",
"instanced": false,
"args": [
"str"
],
"text": "--- Checks if a string is a valid dir.\n-- @param\tstr\tstring\tString to check (be sure to remove any + or -).\n-- @return\tbool\tIf string is a valid dir then true.\nfunction selection.check_dir(str)",
"params": [
{
"directive": "param",
"text": "str\tstring\tString to check (be sure to remove any + or -).",
"name": "str",
"type": "string",
"description": "String to check (be sure to remove any + or -)."
}
],
"returns": {
"directive": "returns",
"text": "bool\tIf string is a valid dir then true.",
"type": "bool",
"description": "If string is a valid dir then true."
},
"examples": [],
"name_full": "worldeditadditions.selection.check_dir",
"filename": "worldeditadditions/lib/selection/selection.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/selection/selection.lua#L94-L97"
}
clear_points 🔗
Clears current selection, *but only pos1 and pos2!
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | Player name. |
Returns
void
Source
--- Clears current selection, *but only pos1 and pos2!
-- @param name string Player name.
-- @returns void
function selection.clear_points(name)
{
"type": "function",
"internal": false,
"description": "Clears current selection, *but only pos1 and pos2!",
"directives": [
{
"directive": "param",
"text": "name\tstring\tPlayer name.",
"name": "name",
"type": "string",
"description": "Player name."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 71,
"namespace": "worldeditadditions.selection",
"line_last": 74,
"name": "clear_points",
"instanced": false,
"args": [
"name"
],
"text": "--- Clears current selection, *but only pos1 and pos2!\n-- @param\tname\tstring\tPlayer name.\n-- @returns\tvoid\nfunction selection.clear_points(name)",
"params": [
{
"directive": "param",
"text": "name\tstring\tPlayer name.",
"name": "name",
"type": "string",
"description": "Player name."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions.selection.clear_points",
"filename": "worldeditadditions/lib/selection/selection.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/selection/selection.lua#L72-L75"
}
Functions
airapply 🔗
Like ellipsoidapply, but only keeps changes that replace airlike nodes, and discards any other changes made. Takes a backup copy of the defined region, runs the given function, and then restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Position | nil | The 1st position defining the region boundary |
pos2 | Position | nil | The 2nd positioon defining the region boundary |
func | function | nil | The function to call that performs the action in question. It is expected that the given function will accept no arguments. |
Returns
nil
Source
--- Like ellipsoidapply, but only keeps changes that replace airlike nodes, and discards any other changes made.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
-- @param pos1 Position The 1st position defining the region boundary
-- @param pos2 Position The 2nd positioon defining the region boundary
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.airapply(pos1, pos2, func)
{
"type": "function",
"internal": false,
"description": "Like ellipsoidapply, but only keeps changes that replace airlike nodes, and discards any other changes made.\nTakes a backup copy of the defined region, runs the given function, and then\nrestores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.",
"directives": [
{
"directive": "param",
"text": "pos1\tPosition\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Position",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\tPosition\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Position",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "func\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"line": 18,
"namespace": "worldeditadditions",
"line_last": 24,
"name": "airapply",
"instanced": false,
"args": [
"pos1",
"pos2",
"func"
],
"text": "--- Like ellipsoidapply, but only keeps changes that replace airlike nodes, and discards any other changes made.\n-- Takes a backup copy of the defined region, runs the given function, and then\n-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.\n-- @param\tpos1\tPosition\tThe 1st position defining the region boundary\n-- @param\tpos2\tPosition\tThe 2nd positioon defining the region boundary \n-- @param\tfunc\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.\nfunction worldeditadditions.airapply(pos1, pos2, func)",
"params": [
{
"directive": "param",
"text": "pos1\tPosition\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Position",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\tPosition\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Position",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "func\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"examples": [],
"name_full": "worldeditadditions.airapply",
"filename": "worldeditadditions/lib/airapply.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/airapply.lua#L19-L25"
}
bonemeal 🔗
Bonemeal command. Applies bonemeal to all nodes with an air bloc above then.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
strength | number | nil | The strength to apply - see bonemeal:on_use |
chance | number | nil | Positive integer that represents the chance bonemealing will occur |
Returns
bool,number,number
:
- Whether the command succeeded or not.
Source
--- Bonemeal command.
-- Applies bonemeal to all nodes with an air bloc above then.
-- @param strength number The strength to apply - see bonemeal:on_use
-- @param chance number Positive integer that represents the chance bonemealing will occur
-- @returns bool,number,number 1. Whether the command succeeded or not.
-- 2. The number of nodes actually bonemealed
-- 3. The number of possible candidates we could have bonemealed
function worldeditadditions.bonemeal(pos1, pos2, strength, chance, nodename_list)
{
"type": "function",
"internal": false,
"description": "Bonemeal command.\nApplies bonemeal to all nodes with an air bloc above then.",
"directives": [
{
"directive": "param",
"text": "strength\tnumber\tThe strength to apply - see bonemeal:on_use",
"name": "strength",
"type": "number",
"description": "The strength to apply - see bonemeal:on_use"
},
{
"directive": "param",
"text": "chance\t\tnumber\t\tPositive integer that represents the chance bonemealing will occur",
"name": "chance",
"type": "number",
"description": "Positive integer that represents the chance bonemealing will occur"
},
{
"directive": "returns",
"text": "bool,number,number\t1. Whether the command succeeded or not.\n\t\t\t\t\t\t\t\t2. The number of nodes actually bonemealed\n\t\t\t\t\t\t\t\t3. The number of possible candidates we could have bonemealed",
"type": "bool,number,number",
"description": "1. Whether the command succeeded or not.\n"
}
],
"line": 6,
"namespace": "worldeditadditions",
"line_last": 13,
"name": "bonemeal",
"instanced": false,
"args": [
"pos1",
"pos2",
"strength",
"chance",
"nodename_list"
],
"text": "--- Bonemeal command.\n-- Applies bonemeal to all nodes with an air bloc above then.\n-- @param\tstrength\tnumber\tThe strength to apply - see bonemeal:on_use\n-- @param\tchance\t\tnumber\t\tPositive integer that represents the chance bonemealing will occur\n-- @returns\tbool,number,number\t1. Whether the command succeeded or not.\n-- \t\t\t\t\t\t\t\t2. The number of nodes actually bonemealed\n-- \t\t\t\t\t\t\t\t3. The number of possible candidates we could have bonemealed\nfunction worldeditadditions.bonemeal(pos1, pos2, strength, chance, nodename_list)",
"params": [
{
"directive": "param",
"text": "strength\tnumber\tThe strength to apply - see bonemeal:on_use",
"name": "strength",
"type": "number",
"description": "The strength to apply - see bonemeal:on_use"
},
{
"directive": "param",
"text": "chance\t\tnumber\t\tPositive integer that represents the chance bonemealing will occur",
"name": "chance",
"type": "number",
"description": "Positive integer that represents the chance bonemealing will occur"
}
],
"returns": {
"directive": "returns",
"text": "bool,number,number\t1. Whether the command succeeded or not.\n\t\t\t\t\t\t\t\t2. The number of nodes actually bonemealed\n\t\t\t\t\t\t\t\t3. The number of possible candidates we could have bonemealed",
"type": "bool,number,number",
"description": "1. Whether the command succeeded or not.\n"
},
"examples": [],
"name_full": "worldeditadditions.bonemeal",
"filename": "worldeditadditions/lib/bonemeal.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/bonemeal.lua#L7-L14"
}
copy 🔗
Copies a region to another location, potentially overwriting the exiting region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source_pos1 | Vector3 | nil | pos1 of the source region to copy. |
source_pos2 | Vector3 | nil | pos2 of the source region to copy. |
target_pos1 | Vector3 | nil | pos1 of the target region to copy to. |
target_pos2 | Vector3 | nil | pos2 of the target region to copy to. |
airapply | bool | false | Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not. |
Returns
bool,numbers
:
- Whether the copy operation was successful or not
Source
--- Copies a region to another location, potentially overwriting the exiting region.
-- @param source_pos1 Vector3 pos1 of the source region to copy.
-- @param source_pos2 Vector3 pos2 of the source region to copy.
-- @param target_pos1 Vector3 pos1 of the target region to copy to.
-- @param target_pos2 Vector3 pos2 of the target region to copy to.
-- @param airapply=false bool Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.
-- @returns bool,numbers 1. Whether the copy operation was successful or not
-- 2. The total number of nodes copied.
function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_pos2, airapply)
{
"type": "function",
"internal": false,
"description": "Copies a region to another location, potentially overwriting the exiting region.",
"directives": [
{
"directive": "param",
"text": "source_pos1\t\tVector3\t\tpos1 of the source region to copy.",
"name": "source_pos1",
"type": "Vector3",
"description": "pos1 of the source region to copy."
},
{
"directive": "param",
"text": "source_pos2\t\tVector3\t\tpos2 of the source region to copy.",
"name": "source_pos2",
"type": "Vector3",
"description": "pos2 of the source region to copy."
},
{
"directive": "param",
"text": "target_pos1\t\tVector3\t\tpos1 of the target region to copy to.",
"name": "target_pos1",
"type": "Vector3",
"description": "pos1 of the target region to copy to."
},
{
"directive": "param",
"text": "target_pos2\t\tVector3\t\tpos2 of the target region to copy to.",
"name": "target_pos2",
"type": "Vector3",
"description": "pos2 of the target region to copy to."
},
{
"directive": "param",
"text": "airapply=false\tbool\t\tWhether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.",
"name": "airapply",
"type": "bool",
"description": "Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.",
"default_value": "false"
},
{
"directive": "returns",
"text": "bool,numbers\t1. Whether the copy operation was successful or not\n\t\t\t\t\t\t\t2. The total number of nodes copied.",
"type": "bool,numbers",
"description": "1. Whether the copy operation was successful or not\n"
}
],
"line": 14,
"namespace": "worldeditadditions",
"line_last": 22,
"name": "copy",
"instanced": false,
"args": [
"source_pos1",
"source_pos2",
"target_pos1",
"target_pos2",
"airapply"
],
"text": "--- Copies a region to another location, potentially overwriting the exiting region.\n-- @param\tsource_pos1\t\tVector3\t\tpos1 of the source region to copy.\n-- @param\tsource_pos2\t\tVector3\t\tpos2 of the source region to copy.\n-- @param\ttarget_pos1\t\tVector3\t\tpos1 of the target region to copy to.\n-- @param\ttarget_pos2\t\tVector3\t\tpos2 of the target region to copy to.\n-- @param\tairapply=false\tbool\t\tWhether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.\n-- @returns\tbool,numbers\t1. Whether the copy operation was successful or not\n-- \t\t\t\t\t\t\t2. The total number of nodes copied.\nfunction worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_pos2, airapply)",
"params": [
{
"directive": "param",
"text": "source_pos1\t\tVector3\t\tpos1 of the source region to copy.",
"name": "source_pos1",
"type": "Vector3",
"description": "pos1 of the source region to copy."
},
{
"directive": "param",
"text": "source_pos2\t\tVector3\t\tpos2 of the source region to copy.",
"name": "source_pos2",
"type": "Vector3",
"description": "pos2 of the source region to copy."
},
{
"directive": "param",
"text": "target_pos1\t\tVector3\t\tpos1 of the target region to copy to.",
"name": "target_pos1",
"type": "Vector3",
"description": "pos1 of the target region to copy to."
},
{
"directive": "param",
"text": "target_pos2\t\tVector3\t\tpos2 of the target region to copy to.",
"name": "target_pos2",
"type": "Vector3",
"description": "pos2 of the target region to copy to."
},
{
"directive": "param",
"text": "airapply=false\tbool\t\tWhether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.",
"name": "airapply",
"type": "bool",
"description": "Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.",
"default_value": "false"
}
],
"returns": {
"directive": "returns",
"text": "bool,numbers\t1. Whether the copy operation was successful or not\n\t\t\t\t\t\t\t2. The total number of nodes copied.",
"type": "bool,numbers",
"description": "1. Whether the copy operation was successful or not\n"
},
"examples": [],
"name_full": "worldeditadditions.copy",
"filename": "worldeditadditions/lib/copy.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/copy.lua#L15-L23"
}
corner_set 🔗
Puts a node at each corner of selection box.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position defining the WorldEdit selection |
pos2 | Vector3 | nil | The 2nd positioon defining the WorldEdit selection |
node | string | nil | Name of the node to place |
Returns
nil
Source
--- Puts a node at each corner of selection box.
-- @param pos1 Vector3 The 1st position defining the WorldEdit selection
-- @param pos2 Vector3 The 2nd positioon defining the WorldEdit selection
-- @param node string Name of the node to place
function worldeditadditions.corner_set(pos1, pos2, node)
{
"type": "function",
"internal": false,
"description": "Puts a node at each corner of selection box.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe 1st position defining the WorldEdit selection",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the WorldEdit selection"
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe 2nd positioon defining the WorldEdit selection",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the WorldEdit selection"
},
{
"directive": "param",
"text": "node\tstring\t\tName of the node to place",
"name": "node",
"type": "string",
"description": "Name of the node to place"
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 16,
"name": "corner_set",
"instanced": false,
"args": [
"pos1",
"pos2",
"node"
],
"text": "--- Puts a node at each corner of selection box.\n-- @param\tpos1\tVector3\t\tThe 1st position defining the WorldEdit selection\n-- @param\tpos2\tVector3\t\tThe 2nd positioon defining the WorldEdit selection\n-- @param\tnode\tstring\t\tName of the node to place\nfunction worldeditadditions.corner_set(pos1, pos2, node)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe 1st position defining the WorldEdit selection",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the WorldEdit selection"
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe 2nd positioon defining the WorldEdit selection",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the WorldEdit selection"
},
{
"directive": "param",
"text": "node\tstring\t\tName of the node to place",
"name": "node",
"type": "string",
"description": "Name of the node to place"
}
],
"examples": [],
"name_full": "worldeditadditions.corner_set",
"filename": "worldeditadditions/lib/wireframe/corner_set.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/wireframe/corner_set.lua#L13-L17"
}
count 🔗
Counts the nodes in a given area.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to count nodes in. |
pos2 | Vector3 | nil | pos2 of the defined region to count nodes in. |
do_human_counts | bool | nil | Whether to return human-readable counts (as a string) instead of the raw numbers. |
Returns
bool,table<number,number>,number
:
- Whether the operation was successful or not.
Source
--- Counts the nodes in a given area.
-- @param pos1 Vector3 pos1 of the defined region to count nodes in.
-- @param pos2 Vector3 pos2 of the defined region to count nodes in.
-- @param do_human_counts bool Whether to return human-readable counts (as a string) instead of the raw numbers.
-- @returns bool,table<number,number>,number 1. Whether the operation was successful or not.
-- 2. A table mapping node ids to the number of that node id seen.
-- 3. The total number of nodes counted.
function worldeditadditions.count(pos1, pos2, do_human_counts)
{
"type": "function",
"internal": false,
"description": "Counts the nodes in a given area.",
"directives": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tpos1 of the defined region to count nodes in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to count nodes in."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tpos2 of the defined region to count nodes in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to count nodes in."
},
{
"directive": "param",
"text": "do_human_counts\tbool\t\tWhether to return human-readable counts (as a string) instead of the raw numbers.",
"name": "do_human_counts",
"type": "bool",
"description": "Whether to return human-readable counts (as a string) instead of the raw numbers."
},
{
"directive": "returns",
"text": "bool,table<number,number>,number\t1. Whether the operation was successful or not.\n\t\t\t\t\t\t\t\t\t\t\t\t2. A table mapping node ids to the number of that node id seen.\n\t\t\t\t\t\t\t\t\t\t\t\t3. The total number of nodes counted.",
"type": "bool,table<number,number>,number",
"description": "1. Whether the operation was successful or not.\n"
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 19,
"name": "count",
"instanced": false,
"args": [
"pos1",
"pos2",
"do_human_counts"
],
"text": "--- Counts the nodes in a given area.\n-- @param\tpos1\t\t\tVector3\t\tpos1 of the defined region to count nodes in.\n-- @param\tpos2\t\t\tVector3\t\tpos2 of the defined region to count nodes in.\n-- @param\tdo_human_counts\tbool\t\tWhether to return human-readable counts (as a string) instead of the raw numbers.\n-- @returns\tbool,table<number,number>,number\t1. Whether the operation was successful or not.\n-- \t\t\t\t\t\t\t\t\t\t\t\t2. A table mapping node ids to the number of that node id seen.\n-- \t\t\t\t\t\t\t\t\t\t\t\t3. The total number of nodes counted.\nfunction worldeditadditions.count(pos1, pos2, do_human_counts)",
"params": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tpos1 of the defined region to count nodes in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to count nodes in."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tpos2 of the defined region to count nodes in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to count nodes in."
},
{
"directive": "param",
"text": "do_human_counts\tbool\t\tWhether to return human-readable counts (as a string) instead of the raw numbers.",
"name": "do_human_counts",
"type": "bool",
"description": "Whether to return human-readable counts (as a string) instead of the raw numbers."
}
],
"returns": {
"directive": "returns",
"text": "bool,table<number,number>,number\t1. Whether the operation was successful or not.\n\t\t\t\t\t\t\t\t\t\t\t\t2. A table mapping node ids to the number of that node id seen.\n\t\t\t\t\t\t\t\t\t\t\t\t3. The total number of nodes counted.",
"type": "bool,table<number,number>,number",
"description": "1. Whether the operation was successful or not.\n"
},
"examples": [],
"name_full": "worldeditadditions.count",
"filename": "worldeditadditions/lib/count.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/count.lua#L13-L20"
}
dome 🔗
Creates a dome shape with the given node, optionally specifying the direction the point should point.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos | Vector3 | nil | The central point to start drawing the dome from. |
radius | number | nil | The radius of the dome to create. |
replace_node | string | nil | The fully qualified name of the node to use to make the dome with. |
pointing_dir | Vector3 | nil | Optional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name. |
hollow | boolean | nil | Whether to make the dome hollow or not. Defaults to false. |
Returns
nil
Source
--- Creates a dome shape with the given node, optionally specifying the
-- direction the point should point.
-- @param pos Vector3 The central point to start drawing the dome from.
-- @param radius number The radius of the dome to create.
-- @param replace_node string The fully qualified name of the node to use to make the dome with.
-- @param pointing_dir Vector3 Optional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name.
-- @param hollow boolean Whether to make the dome hollow or not. Defaults to false.
function worldeditadditions.dome(pos, radius, replace_node, pointing_dir, hollow)
{
"type": "function",
"internal": false,
"description": "Creates a dome shape with the given node, optionally specifying the\ndirection the point should point.",
"directives": [
{
"directive": "param",
"text": "pos\t\t\t\tVector3\t\tThe central point to start drawing the dome from.",
"name": "pos",
"type": "Vector3",
"description": "The central point to start drawing the dome from."
},
{
"directive": "param",
"text": "radius\t\t\tnumber\t\tThe radius of the dome to create.",
"name": "radius",
"type": "number",
"description": "The radius of the dome to create."
},
{
"directive": "param",
"text": "replace_node\tstring\t\tThe fully qualified name of the node to use to make the dome with.",
"name": "replace_node",
"type": "string",
"description": "The fully qualified name of the node to use to make the dome with."
},
{
"directive": "param",
"text": "pointing_dir\tVector3\t\tOptional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name.",
"name": "pointing_dir",
"type": "Vector3",
"description": "Optional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name."
},
{
"directive": "param",
"text": "hollow\t\t\tboolean\t\tWhether to make the dome hollow or not. Defaults to false.",
"name": "hollow",
"type": "boolean",
"description": "Whether to make the dome hollow or not. Defaults to false."
}
],
"line": 11,
"namespace": "worldeditadditions",
"line_last": 18,
"name": "dome",
"instanced": false,
"args": [
"pos",
"radius",
"replace_node",
"pointing_dir",
"hollow"
],
"text": "--- Creates a dome shape with the given node, optionally specifying the\n-- direction the point should point.\n-- @param\tpos\t\t\t\tVector3\t\tThe central point to start drawing the dome from.\n-- @param\tradius\t\t\tnumber\t\tThe radius of the dome to create.\n-- @param\treplace_node\tstring\t\tThe fully qualified name of the node to use to make the dome with.\n-- @param\tpointing_dir\tVector3\t\tOptional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name.\n-- @param\thollow\t\t\tboolean\t\tWhether to make the dome hollow or not. Defaults to false.\nfunction worldeditadditions.dome(pos, radius, replace_node, pointing_dir, hollow)",
"params": [
{
"directive": "param",
"text": "pos\t\t\t\tVector3\t\tThe central point to start drawing the dome from.",
"name": "pos",
"type": "Vector3",
"description": "The central point to start drawing the dome from."
},
{
"directive": "param",
"text": "radius\t\t\tnumber\t\tThe radius of the dome to create.",
"name": "radius",
"type": "number",
"description": "The radius of the dome to create."
},
{
"directive": "param",
"text": "replace_node\tstring\t\tThe fully qualified name of the node to use to make the dome with.",
"name": "replace_node",
"type": "string",
"description": "The fully qualified name of the node to use to make the dome with."
},
{
"directive": "param",
"text": "pointing_dir\tVector3\t\tOptional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name.",
"name": "pointing_dir",
"type": "Vector3",
"description": "Optional. The direction the dome should point. Defaults to (0, 1, 0). See also wea_c.parse.axis_name."
},
{
"directive": "param",
"text": "hollow\t\t\tboolean\t\tWhether to make the dome hollow or not. Defaults to false.",
"name": "hollow",
"type": "boolean",
"description": "Whether to make the dome hollow or not. Defaults to false."
}
],
"examples": [],
"name_full": "worldeditadditions.dome",
"filename": "worldeditadditions/lib/dome.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/dome.lua#L12-L19"
}
ellipsoid 🔗
Fills an ellipsoidal area around the given position with the target node. The resulting ellipsoid may optionally be hollow (in which case nodes inside the ellipsoid are left untouched).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
position | Vector3 | nil | The centre position of the ellipsoid. |
radius | Vector3 | nil | The radius of the ellipsoid in all 3 dimensions. |
target_node | string | nil | The name of the node to use to fill the ellipsoid. |
hollow | bool | nil | Whether the ellipsoid should be hollow or not. |
Returns
number
:
The number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered.
Source
--- Fills an ellipsoidal area around the given position with the target node.
-- The resulting ellipsoid may optionally be hollow (in which case
-- nodes inside the ellipsoid are left untouched).
-- @param position Vector3 The centre position of the ellipsoid.
-- @param radius Vector3 The radius of the ellipsoid in all 3 dimensions.
-- @param target_node string The name of the node to use to fill the ellipsoid.
-- @param hollow bool Whether the ellipsoid should be hollow or not.
-- @returns number The number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered.
function worldeditadditions.ellipsoid(position, radius, target_node, hollow)
{
"type": "function",
"internal": false,
"description": "Fills an ellipsoidal area around the given position with the target node.\nThe resulting ellipsoid may optionally be hollow (in which case\nnodes inside the ellipsoid are left untouched).",
"directives": [
{
"directive": "param",
"text": "position\tVector3\t\tThe centre position of the ellipsoid.",
"name": "position",
"type": "Vector3",
"description": "The centre position of the ellipsoid."
},
{
"directive": "param",
"text": "radius\t\tVector3\t\tThe radius of the ellipsoid in all 3 dimensions.",
"name": "radius",
"type": "Vector3",
"description": "The radius of the ellipsoid in all 3 dimensions."
},
{
"directive": "param",
"text": "target_node\tstring\t\tThe name of the node to use to fill the ellipsoid.",
"name": "target_node",
"type": "string",
"description": "The name of the node to use to fill the ellipsoid."
},
{
"directive": "param",
"text": "hollow\t\tbool\t\tWhether the ellipsoid should be hollow or not.",
"name": "hollow",
"type": "bool",
"description": "Whether the ellipsoid should be hollow or not."
},
{
"directive": "returns",
"text": "number\t\tThe number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered.",
"type": "number",
"description": "The number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered."
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 20,
"name": "ellipsoid",
"instanced": false,
"args": [
"position",
"radius",
"target_node",
"hollow"
],
"text": "--- Fills an ellipsoidal area around the given position with the target node.\n-- The resulting ellipsoid may optionally be hollow (in which case\n-- nodes inside the ellipsoid are left untouched).\n-- @param\tposition\tVector3\t\tThe centre position of the ellipsoid.\n-- @param\tradius\t\tVector3\t\tThe radius of the ellipsoid in all 3 dimensions.\n-- @param\ttarget_node\tstring\t\tThe name of the node to use to fill the ellipsoid.\n-- @param\thollow\t\tbool\t\tWhether the ellipsoid should be hollow or not.\n-- @returns\tnumber\t\tThe number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered.\nfunction worldeditadditions.ellipsoid(position, radius, target_node, hollow)",
"params": [
{
"directive": "param",
"text": "position\tVector3\t\tThe centre position of the ellipsoid.",
"name": "position",
"type": "Vector3",
"description": "The centre position of the ellipsoid."
},
{
"directive": "param",
"text": "radius\t\tVector3\t\tThe radius of the ellipsoid in all 3 dimensions.",
"name": "radius",
"type": "Vector3",
"description": "The radius of the ellipsoid in all 3 dimensions."
},
{
"directive": "param",
"text": "target_node\tstring\t\tThe name of the node to use to fill the ellipsoid.",
"name": "target_node",
"type": "string",
"description": "The name of the node to use to fill the ellipsoid."
},
{
"directive": "param",
"text": "hollow\t\tbool\t\tWhether the ellipsoid should be hollow or not.",
"name": "hollow",
"type": "bool",
"description": "Whether the ellipsoid should be hollow or not."
}
],
"returns": {
"directive": "returns",
"text": "number\t\tThe number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered.",
"type": "number",
"description": "The number of nodes filled to create the (optionally hollow) ellipsoid. This number will be lower with hollow ellipsoids, since the internals of an ellipsoid aren't altered."
},
"examples": [],
"name_full": "worldeditadditions.ellipsoid",
"filename": "worldeditadditions/lib/ellipsoid.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/ellipsoid.lua#L13-L21"
}
ellipsoidapply 🔗
Similar to cubeapply, except that it takes 2 positions and only keeps an ellipsoid-shaped area defined by the boundaries of the defined region. Takes a backup copy of the defined region, runs the given function, and then restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position defining the region boundary |
pos2 | Vector3 | nil | The 2nd positioon defining the region boundary |
func | function | nil | The function to call that performs the action in question. It is expected that the given function will accept no arguments. |
Returns
nil
Source
--- Similar to cubeapply, except that it takes 2 positions and only keeps an ellipsoid-shaped area defined by the boundaries of the defined region.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
-- @param pos1 Vector3 The 1st position defining the region boundary
-- @param pos2 Vector3 The 2nd positioon defining the region boundary
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.ellipsoidapply(pos1, pos2, func)
{
"type": "function",
"internal": false,
"description": "Similar to cubeapply, except that it takes 2 positions and only keeps an ellipsoid-shaped area defined by the boundaries of the defined region.\nTakes a backup copy of the defined region, runs the given function, and then\nrestores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "func\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"line": 18,
"namespace": "worldeditadditions",
"line_last": 24,
"name": "ellipsoidapply",
"instanced": false,
"args": [
"pos1",
"pos2",
"func"
],
"text": "--- Similar to cubeapply, except that it takes 2 positions and only keeps an ellipsoid-shaped area defined by the boundaries of the defined region.\n-- Takes a backup copy of the defined region, runs the given function, and then\n-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.\n-- @param\tpos1\tVector3\t\tThe 1st position defining the region boundary\n-- @param\tpos2\tVector3\t\tThe 2nd positioon defining the region boundary \n-- @param\tfunc\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.\nfunction worldeditadditions.ellipsoidapply(pos1, pos2, func)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "func\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"examples": [],
"name_full": "worldeditadditions.ellipsoidapply",
"filename": "worldeditadditions/lib/ellipsoidapply.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/ellipsoidapply.lua#L19-L25"
}
fillcaves 🔗
Fill caves command. Fills underneath non-air nodes in the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to fill caves in. |
pos2 | Vector3 | nil | pos2 of the defined region to fill caves in. |
node_name | string | nil | The name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions. |
Returns
bool,{replaced=number}
:
- Whether the fill caves operation was successful or not.
Source
--- Fill caves command. Fills underneath non-air nodes in the defined region.
-- @param pos1 Vector3 pos1 of the defined region to fill caves in.
-- @param pos2 Vector3 pos2 of the defined region to fill caves in.
-- @param node_name string The name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions.
-- @returns bool,{replaced=number} 1. Whether the fill caves operation was successful or not.
-- 2. A table of statistics about the operation. Currently the only key in this table is `replaced`, which is the number of (air-like) nodes that were replaced during the operation.
function worldeditadditions.fillcaves(pos1, pos2, node_name)
{
"type": "function",
"internal": false,
"description": "Fill caves command. Fills underneath non-air nodes in the defined region.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to fill caves in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to fill caves in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to fill caves in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to fill caves in."
},
{
"directive": "param",
"text": "node_name\tstring\t\tThe name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions.",
"name": "node_name",
"type": "string",
"description": "The name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions."
},
{
"directive": "returns",
"text": "bool,{replaced=number}\t1. Whether the fill caves operation was successful or not.\n\t\t\t\t\t\t\t\t\t2. A table of statistics about the operation. Currently the only key in this table is `replaced`, which is the number of (air-like) nodes that were replaced during the operation.",
"type": "bool,{replaced=number}",
"description": "1. Whether the fill caves operation was successful or not.\n"
}
],
"line": 6,
"namespace": "worldeditadditions",
"line_last": 12,
"name": "fillcaves",
"instanced": false,
"args": [
"pos1",
"pos2",
"node_name"
],
"text": "--- Fill caves command. Fills underneath non-air nodes in the defined region.\n-- @param\tpos1\t\tVector3\t\tpos1 of the defined region to fill caves in.\n-- @param\tpos2\t\tVector3\t\tpos2 of the defined region to fill caves in.\n-- @param\tnode_name\tstring\t\tThe name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions.\n-- @returns\tbool,{replaced=number}\t1. Whether the fill caves operation was successful or not.\n-- \t\t\t\t\t\t\t\t\t2. A table of statistics about the operation. Currently the only key in this table is `replaced`, which is the number of (air-like) nodes that were replaced during the operation.\nfunction worldeditadditions.fillcaves(pos1, pos2, node_name)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to fill caves in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to fill caves in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to fill caves in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to fill caves in."
},
{
"directive": "param",
"text": "node_name\tstring\t\tThe name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions.",
"name": "node_name",
"type": "string",
"description": "The name of the node to replace air nodes with. Should have been already normalised, as with all other worldeditadditions.* functions."
}
],
"returns": {
"directive": "returns",
"text": "bool,{replaced=number}\t1. Whether the fill caves operation was successful or not.\n\t\t\t\t\t\t\t\t\t2. A table of statistics about the operation. Currently the only key in this table is `replaced`, which is the number of (air-like) nodes that were replaced during the operation.",
"type": "bool,{replaced=number}",
"description": "1. Whether the fill caves operation was successful or not.\n"
},
"examples": [],
"name_full": "worldeditadditions.fillcaves",
"filename": "worldeditadditions/lib/fillcaves.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/fillcaves.lua#L7-L13"
}
floodfill 🔗
Flood-fill command for complex lakes etc.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
start_pos | Vector3 | nil | The position to start floodfilling from. |
radius | number | nil | The maximum radius to limit the floodfill operation too. |
replace_node | string | nil | The (normalised) name of the node to replace with when floodfilling. |
Returns
number
:
The number of nodes replaced.
Source
--- Flood-fill command for complex lakes etc.
-- @param start_pos Vector3 The position to start floodfilling from.
-- @param radius number The maximum radius to limit the floodfill operation too.
-- @param replace_node string The (normalised) name of the node to replace with when floodfilling.
-- @returns number The number of nodes replaced.
function worldeditadditions.floodfill(start_pos, radius, replace_node)
{
"type": "function",
"internal": false,
"description": "Flood-fill command for complex lakes etc.",
"directives": [
{
"directive": "param",
"text": "start_pos\t\tVector3\t\tThe position to start floodfilling from.",
"name": "start_pos",
"type": "Vector3",
"description": "The position to start floodfilling from."
},
{
"directive": "param",
"text": "radius\t\t\tnumber\t\tThe maximum radius to limit the floodfill operation too.",
"name": "radius",
"type": "number",
"description": "The maximum radius to limit the floodfill operation too."
},
{
"directive": "param",
"text": "replace_node\tstring\t\tThe (normalised) name of the node to replace with when floodfilling.",
"name": "replace_node",
"type": "string",
"description": "The (normalised) name of the node to replace with when floodfilling."
},
{
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced.",
"type": "number",
"description": "The number of nodes replaced."
}
],
"line": 7,
"namespace": "worldeditadditions",
"line_last": 12,
"name": "floodfill",
"instanced": false,
"args": [
"start_pos",
"radius",
"replace_node"
],
"text": "--- Flood-fill command for complex lakes etc.\n-- @param\tstart_pos\t\tVector3\t\tThe position to start floodfilling from.\n-- @param\tradius\t\t\tnumber\t\tThe maximum radius to limit the floodfill operation too.\n-- @param\treplace_node\tstring\t\tThe (normalised) name of the node to replace with when floodfilling.\n-- @returns\tnumber\t\t\tThe number of nodes replaced.\nfunction worldeditadditions.floodfill(start_pos, radius, replace_node)",
"params": [
{
"directive": "param",
"text": "start_pos\t\tVector3\t\tThe position to start floodfilling from.",
"name": "start_pos",
"type": "Vector3",
"description": "The position to start floodfilling from."
},
{
"directive": "param",
"text": "radius\t\t\tnumber\t\tThe maximum radius to limit the floodfill operation too.",
"name": "radius",
"type": "number",
"description": "The maximum radius to limit the floodfill operation too."
},
{
"directive": "param",
"text": "replace_node\tstring\t\tThe (normalised) name of the node to replace with when floodfilling.",
"name": "replace_node",
"type": "string",
"description": "The (normalised) name of the node to replace with when floodfilling."
}
],
"returns": {
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced.",
"type": "number",
"description": "The number of nodes replaced."
},
"examples": [],
"name_full": "worldeditadditions.floodfill",
"filename": "worldeditadditions/lib/floodfill.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/floodfill.lua#L8-L13"
}
forest 🔗
Places saplings and bonemeals them automatically to create a forest. Note that the defined region is the region that saplings are placed in, so nodes may ultimately end up being replaced outside the defined region depending on the size of the tree that grows.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to place saplings in. |
pos2 | Vector3 | nil | pos2 of the defined region to place saplings in. |
density_multiplier | number | nil | The density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest. Note that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated. |
sapling_weights | table<string,number> | nil | A table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings. |
Returns
bool,table<string,number>
:
- Whether the operation was successful or not. For example, this command might fail if the
bonemeal
mod is not installed.
Source
--- Places saplings and bonemeals them automatically to create a forest.
-- Note that the defined region is *the region that saplings are placed in*, so nodes may ultimately end up being replaced outside the defined region depending on the size of the tree that grows.
-- @param pos1 Vector3 pos1 of the defined region to place saplings in.
-- @param pos2 Vector3 pos2 of the defined region to place saplings in.
-- @param density_multiplier number The density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest.
--
-- Note that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated.
-- @param sapling_weights table<string,number> A table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings.
-- @returns bool,table<string,number> 1. Whether the operation was successful or not. For example, this command might fail if the `bonemeal` mod is not installed.
-- 2. A table of statistics about the operation:
-- | Key | Meaning |
-- |----------------|-----------|
-- | `attempts` | A table of numbers indicating how many bonemeal attempts each sapling took to grow. Saplings that failed to grow within 100 attempts are considered a failure and not logged in this table. |
-- | `attempts_avg` | The average number of attempts saplings took to grow. |
-- | `failures` | The number of saplings placed that failed to grow within the 100 attempts limit. |
-- | `successes` | The number of saplings that were placed and successfully grow into a tree. |
-- | `placed` | A `table<number,number>` map of sapling node ids and how many of that sapling type successfully grew.
function worldeditadditions.forest(pos1, pos2, density_multiplier, sapling_weights)
{
"type": "function",
"internal": false,
"description": "Places saplings and bonemeals them automatically to create a forest.\nNote that the defined region is *the region that saplings are placed in*, so nodes may ultimately end up being replaced outside the defined region depending on the size of the tree that grows.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to place saplings in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to place saplings in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to place saplings in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to place saplings in."
},
{
"directive": "param",
"text": "density_multiplier\tnumber\tThe density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest.\n\nNote that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated.",
"name": "density_multiplier",
"type": "number",
"description": "The density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest.\n\nNote that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated."
},
{
"directive": "param",
"text": "sapling_weights\t\ttable<string,number>\tA table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings.",
"name": "sapling_weights",
"type": "table<string,number>",
"description": "A table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings."
},
{
"directive": "returns",
"text": "bool,table<string,number>\t1. Whether the operation was successful or not. For example, this command might fail if the `bonemeal` mod is not installed.\n\t\t\t\t\t\t\t\t\t\t2. A table of statistics about the operation:\n| Key\t\t\t| Meaning\t|\n|----------------|-----------|\n| `attempts`\t\t| A table of numbers indicating how many bonemeal attempts each sapling took to grow. Saplings that failed to grow within 100 attempts are considered a failure and not logged in this table. |\n| `attempts_avg`\t| The average number of attempts saplings took to grow. |\n| `failures`\t\t| The number of saplings placed that failed to grow within the 100 attempts limit.\t|\n| `successes`\t| The number of saplings that were placed and successfully grow into a tree. |\n| `placed`\t\t| A `table<number,number>` map of sapling node ids and how many of that sapling type successfully grew.",
"type": "bool,table<string,number>",
"description": "1. Whether the operation was successful or not. For example, this command might fail if the `bonemeal` mod is not installed.\n"
}
],
"line": 6,
"namespace": "worldeditadditions",
"line_last": 23,
"name": "forest",
"instanced": false,
"args": [
"pos1",
"pos2",
"density_multiplier",
"sapling_weights"
],
"text": "--- Places saplings and bonemeals them automatically to create a forest.\n-- Note that the defined region is *the region that saplings are placed in*, so nodes may ultimately end up being replaced outside the defined region depending on the size of the tree that grows.\n-- @param\tpos1\t\tVector3\t\tpos1 of the defined region to place saplings in.\n-- @param\tpos2\t\tVector3\t\tpos2 of the defined region to place saplings in.\n-- @param\tdensity_multiplier\tnumber\tThe density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest.\n-- \n-- Note that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated.\n-- @param\tsapling_weights\t\ttable<string,number>\tA table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings.\n-- @returns\tbool,table<string,number>\t1. Whether the operation was successful or not. For example, this command might fail if the `bonemeal` mod is not installed.\n-- \t\t\t\t\t\t\t\t\t\t2. A table of statistics about the operation:\n-- | Key\t\t\t| Meaning\t|\n-- |----------------|-----------|\n-- | `attempts`\t\t| A table of numbers indicating how many bonemeal attempts each sapling took to grow. Saplings that failed to grow within 100 attempts are considered a failure and not logged in this table. |\n-- | `attempts_avg`\t| The average number of attempts saplings took to grow. |\n-- | `failures`\t\t| The number of saplings placed that failed to grow within the 100 attempts limit.\t|\n-- | `successes`\t| The number of saplings that were placed and successfully grow into a tree. |\n-- | `placed`\t\t| A `table<number,number>` map of sapling node ids and how many of that sapling type successfully grew.\nfunction worldeditadditions.forest(pos1, pos2, density_multiplier, sapling_weights)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to place saplings in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to place saplings in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to place saplings in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to place saplings in."
},
{
"directive": "param",
"text": "density_multiplier\tnumber\tThe density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest.\n\nNote that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated.",
"name": "density_multiplier",
"type": "number",
"description": "The density of the forest to create. Nominally 1. Higher values increase the density at which saplings are placed, thereby increasing the density of the resulting forest.\n\nNote that sapling growth rules are respected, so there is a limit to the maximum density at which a forest can be generated."
},
{
"directive": "param",
"text": "sapling_weights\t\ttable<string,number>\tA table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings.",
"name": "sapling_weights",
"type": "table<string,number>",
"description": "A table mapping (normalised) sapling names to their relative weight. Higher weights mean an increased chance of that particular sapling being chosen. Weights need not add up to any particular value. worldeditadditions.overlay() is used under the hood to place saplings."
}
],
"returns": {
"directive": "returns",
"text": "bool,table<string,number>\t1. Whether the operation was successful or not. For example, this command might fail if the `bonemeal` mod is not installed.\n\t\t\t\t\t\t\t\t\t\t2. A table of statistics about the operation:\n| Key\t\t\t| Meaning\t|\n|----------------|-----------|\n| `attempts`\t\t| A table of numbers indicating how many bonemeal attempts each sapling took to grow. Saplings that failed to grow within 100 attempts are considered a failure and not logged in this table. |\n| `attempts_avg`\t| The average number of attempts saplings took to grow. |\n| `failures`\t\t| The number of saplings placed that failed to grow within the 100 attempts limit.\t|\n| `successes`\t| The number of saplings that were placed and successfully grow into a tree. |\n| `placed`\t\t| A `table<number,number>` map of sapling node ids and how many of that sapling type successfully grew.",
"type": "bool,table<string,number>",
"description": "1. Whether the operation was successful or not. For example, this command might fail if the `bonemeal` mod is not installed.\n"
},
"examples": [],
"name_full": "worldeditadditions.forest",
"filename": "worldeditadditions/lib/forest.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/forest.lua#L7-L24"
}
layers 🔗
Replaces the non-air nodes in each column with a list of nodes from top to bottom.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | Position 1 of the region to operate on |
pos2 | Vector | nil | Position 2 of the region to operate on |
node_weights | string[] | nil | |
min_slope | number? | nil | |
max_slope | number? | nil |
Returns
table<string,number>
Source
--- Replaces the non-air nodes in each column with a list of nodes from top to bottom.
-- @param pos1 Vector Position 1 of the region to operate on
-- @param pos2 Vector Position 2 of the region to operate on
-- @param node_weights string[]
-- @param min_slope number?
-- @param max_slope number?
-- @returns table<string,number>
function worldeditadditions.layers(pos1, pos2, node_weights, min_slope, max_slope)
{
"type": "function",
"internal": false,
"description": "Replaces the non-air nodes in each column with a list of nodes from top to bottom.",
"directives": [
{
"directive": "param",
"text": "pos1\t\t\tVector\t\tPosition 1 of the region to operate on",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the region to operate on"
},
{
"directive": "param",
"text": "pos2\t\t\tVector\t\tPosition 2 of the region to operate on",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the region to operate on"
},
{
"directive": "param",
"text": "node_weights\tstring[]",
"name": "node_weights",
"type": "string[]"
},
{
"directive": "param",
"text": "min_slope\t\tnumber?",
"name": "min_slope",
"type": "number?"
},
{
"directive": "param",
"text": "max_slope\t\tnumber?",
"name": "max_slope",
"type": "number?"
},
{
"directive": "returns",
"text": "table<string,number>",
"type": "table<string,number>"
}
],
"line": 22,
"namespace": "worldeditadditions",
"line_last": 29,
"name": "layers",
"instanced": false,
"args": [
"pos1",
"pos2",
"node_weights",
"min_slope",
"max_slope"
],
"text": "--- Replaces the non-air nodes in each column with a list of nodes from top to bottom.\n-- @param\tpos1\t\t\tVector\t\tPosition 1 of the region to operate on\n-- @param\tpos2\t\t\tVector\t\tPosition 2 of the region to operate on\n-- @param\tnode_weights\tstring[]\t\n-- @param\tmin_slope\t\tnumber?\t\t\n-- @param\tmax_slope\t\tnumber?\t\t\n-- @returns\ttable<string,number>\nfunction worldeditadditions.layers(pos1, pos2, node_weights, min_slope, max_slope)",
"params": [
{
"directive": "param",
"text": "pos1\t\t\tVector\t\tPosition 1 of the region to operate on",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the region to operate on"
},
{
"directive": "param",
"text": "pos2\t\t\tVector\t\tPosition 2 of the region to operate on",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the region to operate on"
},
{
"directive": "param",
"text": "node_weights\tstring[]",
"name": "node_weights",
"type": "string[]"
},
{
"directive": "param",
"text": "min_slope\t\tnumber?",
"name": "min_slope",
"type": "number?"
},
{
"directive": "param",
"text": "max_slope\t\tnumber?",
"name": "max_slope",
"type": "number?"
}
],
"returns": {
"directive": "returns",
"text": "table<string,number>",
"type": "table<string,number>"
},
"examples": [],
"name_full": "worldeditadditions.layers",
"filename": "worldeditadditions/lib/layers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/layers.lua#L23-L30"
}
line 🔗
Counts the nodes in a given area.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The position to start drawing the line from. |
pos2 | Vector3 | nil | The position to draw the line to. |
thickness | number | nil | The thickness of the line to draw. |
node_name | string | nil | The (normalised) name of the node to draw the line with. |
Returns
bool,{replaced=number}
:
- A bool indicating whether the operation was successful or not.
Source
--- Counts the nodes in a given area.
-- @param pos1 Vector3 The position to start drawing the line from.
-- @param pos2 Vector3 The position to draw the line to.
-- @param thickness number The thickness of the line to draw.
-- @param node_name string The (normalised) name of the node to draw the line with.
-- @returns bool,{replaced=number} 1. A bool indicating whether the operation was successful or not.
-- 2. A table containing statistics. At present the only key in this table is `replaced`, which indicates the number of nodes replaced when drawing the line.
function worldeditadditions.line(pos1, pos2, thickness, node_name)
{
"type": "function",
"internal": false,
"description": "Counts the nodes in a given area.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe position to start drawing the line from.",
"name": "pos1",
"type": "Vector3",
"description": "The position to start drawing the line from."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tThe position to draw the line to.",
"name": "pos2",
"type": "Vector3",
"description": "The position to draw the line to."
},
{
"directive": "param",
"text": "thickness\tnumber\t\tThe thickness of the line to draw.",
"name": "thickness",
"type": "number",
"description": "The thickness of the line to draw."
},
{
"directive": "param",
"text": "node_name\tstring\t\tThe (normalised) name of the node to draw the line with.",
"name": "node_name",
"type": "string",
"description": "The (normalised) name of the node to draw the line with."
},
{
"directive": "returns",
"text": "bool,{replaced=number}\t1. A bool indicating whether the operation was successful or not.\n\t\t\t\t\t\t\t\t\t2. A table containing statistics. At present the only key in this table is `replaced`, which indicates the number of nodes replaced when drawing the line.",
"type": "bool,{replaced=number}",
"description": "1. A bool indicating whether the operation was successful or not.\n"
}
],
"line": 13,
"namespace": "worldeditadditions",
"line_last": 20,
"name": "line",
"instanced": false,
"args": [
"pos1",
"pos2",
"thickness",
"node_name"
],
"text": "--- Counts the nodes in a given area.\n-- @param\tpos1\t\tVector3\t\tThe position to start drawing the line from.\n-- @param\tpos2\t\tVector3\t\tThe position to draw the line to.\n-- @param\tthickness\tnumber\t\tThe thickness of the line to draw.\n-- @param\tnode_name\tstring\t\tThe (normalised) name of the node to draw the line with.\n-- @returns\tbool,{replaced=number}\t1. A bool indicating whether the operation was successful or not.\n-- \t\t\t\t\t\t\t\t\t2. A table containing statistics. At present the only key in this table is `replaced`, which indicates the number of nodes replaced when drawing the line.\nfunction worldeditadditions.line(pos1, pos2, thickness, node_name)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe position to start drawing the line from.",
"name": "pos1",
"type": "Vector3",
"description": "The position to start drawing the line from."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tThe position to draw the line to.",
"name": "pos2",
"type": "Vector3",
"description": "The position to draw the line to."
},
{
"directive": "param",
"text": "thickness\tnumber\t\tThe thickness of the line to draw.",
"name": "thickness",
"type": "number",
"description": "The thickness of the line to draw."
},
{
"directive": "param",
"text": "node_name\tstring\t\tThe (normalised) name of the node to draw the line with.",
"name": "node_name",
"type": "string",
"description": "The (normalised) name of the node to draw the line with."
}
],
"returns": {
"directive": "returns",
"text": "bool,{replaced=number}\t1. A bool indicating whether the operation was successful or not.\n\t\t\t\t\t\t\t\t\t2. A table containing statistics. At present the only key in this table is `replaced`, which indicates the number of nodes replaced when drawing the line.",
"type": "bool,{replaced=number}",
"description": "1. A bool indicating whether the operation was successful or not.\n"
},
"examples": [],
"name_full": "worldeditadditions.line",
"filename": "worldeditadditions/lib/line.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/line.lua#L14-L21"
}
make_compass 🔗
Makes a compass with a bead pointing north (+Z).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position defining the WorldEdit selection |
node1 | string | nil | Name of the node to place |
node2 | string | nil | Name of the node of the bead |
Returns
nil
Source
--- Makes a compass with a bead pointing north (+Z).
-- @param pos1 Vector3 The 1st position defining the WorldEdit selection
-- @param node1 string Name of the node to place
-- @param node2 string Name of the node of the bead
function worldeditadditions.make_compass(pos1,node1,node2)
{
"type": "function",
"internal": false,
"description": "Makes a compass with a bead pointing north (+Z).",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\tThe 1st position defining the WorldEdit selection",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the WorldEdit selection"
},
{
"directive": "param",
"text": "node1\tstring\tName of the node to place",
"name": "node1",
"type": "string",
"description": "Name of the node to place"
},
{
"directive": "param",
"text": "node2\tstring\tName of the node of the bead",
"name": "node2",
"type": "string",
"description": "Name of the node of the bead"
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 16,
"name": "make_compass",
"instanced": false,
"args": [
"pos1",
"node1",
"node2"
],
"text": "--- Makes a compass with a bead pointing north (+Z).\n-- @param\tpos1\tVector3\tThe 1st position defining the WorldEdit selection\n-- @param\tnode1\tstring\tName of the node to place\n-- @param\tnode2\tstring\tName of the node of the bead\nfunction worldeditadditions.make_compass(pos1,node1,node2)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\tThe 1st position defining the WorldEdit selection",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the WorldEdit selection"
},
{
"directive": "param",
"text": "node1\tstring\tName of the node to place",
"name": "node1",
"type": "string",
"description": "Name of the node to place"
},
{
"directive": "param",
"text": "node2\tstring\tName of the node of the bead",
"name": "node2",
"type": "string",
"description": "Name of the node of the bead"
}
],
"examples": [],
"name_full": "worldeditadditions.make_compass",
"filename": "worldeditadditions/lib/wireframe/make_compass.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/wireframe/make_compass.lua#L13-L17"
}
maze2d 🔗
Generates a 2D maze. Algorithm origin: https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html
The defined region must be at least 3 x 1 x 3 (x, y, z) for a maze to generate successfully.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to draw the 2D maze in in. |
pos2 | Vector3 | nil | pos2 of the defined region to draw the 2D maze in in. |
target_node | string | nil | The (normalised) node name to draw the maze in. |
path_length | number | 2 | Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors. |
path_width | number | 1 | Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors. Caution: Make sure this value is not higher than |
Returns
number
:
The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).
Source
--- Generates a 2D maze.
-- **Algorithm origin:** https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html
--
-- The defined region must be at least 3 x 1 x 3 (x, y, z) for a maze to generate successfully.
-- @param pos1 Vector3 pos1 of the defined region to draw the 2D maze in in.
-- @param pos2 Vector3 pos2 of the defined region to draw the 2D maze in in.
-- @param target_node string The (normalised) node name to draw the maze in.
-- @param path_length=2 number Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors.
-- @param path_width=1 number Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.
-- **Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!
-- @returns number The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).
function worldeditadditions.maze2d(pos1, pos2, target_node, seed, path_length, path_width)
{
"type": "function",
"internal": false,
"description": "Generates a 2D maze.\n**Algorithm origin:** https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html\n\nThe defined region must be at least 3 x 1 x 3 (x, y, z) for a maze to generate successfully.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to draw the 2D maze in in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to draw the 2D maze in in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to draw the 2D maze in in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to draw the 2D maze in in."
},
{
"directive": "param",
"text": "target_node\t\tstring\t\tThe (normalised) node name to draw the maze in.",
"name": "target_node",
"type": "string",
"description": "The (normalised) node name to draw the maze in."
},
{
"directive": "param",
"text": "path_length=2\tnumber\t\tStep this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"name": "path_length",
"type": "number",
"description": "Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"default_value": "2"
},
{
"directive": "param",
"text": "path_width=1\tnumber\t\tMake all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"name": "path_width",
"type": "number",
"description": "Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"default_value": "1"
},
{
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).",
"type": "number",
"description": "The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2)."
}
],
"line": 120,
"namespace": "worldeditadditions",
"line_last": 131,
"name": "maze2d",
"instanced": false,
"args": [
"pos1",
"pos2",
"target_node",
"seed",
"path_length",
"path_width"
],
"text": "--- Generates a 2D maze.\n-- **Algorithm origin:** https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html\n-- \n-- The defined region must be at least 3 x 1 x 3 (x, y, z) for a maze to generate successfully.\n-- @param\tpos1\t\tVector3\t\tpos1 of the defined region to draw the 2D maze in in.\n-- @param\tpos2\t\tVector3\t\tpos2 of the defined region to draw the 2D maze in in.\n-- @param\ttarget_node\t\tstring\t\tThe (normalised) node name to draw the maze in.\n-- @param\tpath_length=2\tnumber\t\tStep this many nodes forwards at once when generating the maze. Higher values create long thin corridors.\n-- @param\tpath_width=1\tnumber\t\tMake all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n-- **Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!\n-- @returns\tnumber\t\t\tThe number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).\nfunction worldeditadditions.maze2d(pos1, pos2, target_node, seed, path_length, path_width)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to draw the 2D maze in in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to draw the 2D maze in in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to draw the 2D maze in in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to draw the 2D maze in in."
},
{
"directive": "param",
"text": "target_node\t\tstring\t\tThe (normalised) node name to draw the maze in.",
"name": "target_node",
"type": "string",
"description": "The (normalised) node name to draw the maze in."
},
{
"directive": "param",
"text": "path_length=2\tnumber\t\tStep this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"name": "path_length",
"type": "number",
"description": "Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"default_value": "2"
},
{
"directive": "param",
"text": "path_width=1\tnumber\t\tMake all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"name": "path_width",
"type": "number",
"description": "Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"default_value": "1"
}
],
"returns": {
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).",
"type": "number",
"description": "The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2)."
},
"examples": [],
"name_full": "worldeditadditions.maze2d",
"filename": "worldeditadditions/lib/maze2d.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/maze2d.lua#L121-L132"
}
maze3d 🔗
Generates a 3D maze. Algorithm origin: https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html
The defined region must be at least 3 x 3 x 3 (x, y, z) for a maze to generate.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to draw the 3D maze in in. |
pos2 | Vector3 | nil | pos2 of the defined region to draw the 3D maze in in. |
target_node | string | nil | The (normalised) node name to draw the maze in. |
path_length | number | 2 | Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors. |
path_width | number | 1 | Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors. Caution: Make sure this value is not higher than |
path_depth | number | 1 | Make all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze. Caution: The same warning as with |
Returns
number
:
The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).
Source
--- Generates a 3D maze.
-- **Algorithm origin:** https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html
--
-- The defined region must be at least 3 x 3 x 3 (x, y, z) for a maze to generate.
-- @param pos1 Vector3 pos1 of the defined region to draw the 3D maze in in.
-- @param pos2 Vector3 pos2 of the defined region to draw the 3D maze in in.
-- @param target_node string The (normalised) node name to draw the maze in.
-- @param path_length=2 number Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors.
-- @param path_width=1 number Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.
-- **Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!
-- @param path_depth=1 number Make all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze.
-- **Caution:** The same warning as with `path_width` applies here also!
-- @returns number The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).
function worldeditadditions.maze3d(pos1, pos2, target_node, seed, path_length, path_width, path_depth)
{
"type": "function",
"internal": false,
"description": "Generates a 3D maze.\n**Algorithm origin:** https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html\n\nThe defined region must be at least 3 x 3 x 3 (x, y, z) for a maze to generate.",
"directives": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tpos1 of the defined region to draw the 3D maze in in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to draw the 3D maze in in."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tpos2 of the defined region to draw the 3D maze in in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to draw the 3D maze in in."
},
{
"directive": "param",
"text": "target_node\t\tstring\t\tThe (normalised) node name to draw the maze in.",
"name": "target_node",
"type": "string",
"description": "The (normalised) node name to draw the maze in."
},
{
"directive": "param",
"text": "path_length=2\tnumber\t\tStep this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"name": "path_length",
"type": "number",
"description": "Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"default_value": "2"
},
{
"directive": "param",
"text": "path_width=1\tnumber\t\tMake all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"name": "path_width",
"type": "number",
"description": "Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"default_value": "1"
},
{
"directive": "param",
"text": "path_depth=1\tnumber\t\tMake all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze.\n**Caution:** The same warning as with `path_width` applies here also!",
"name": "path_depth",
"type": "number",
"description": "Make all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze.\n**Caution:** The same warning as with `path_width` applies here also!",
"default_value": "1"
},
{
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).",
"type": "number",
"description": "The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2)."
}
],
"line": 173,
"namespace": "worldeditadditions",
"line_last": 186,
"name": "maze3d",
"instanced": false,
"args": [
"pos1",
"pos2",
"target_node",
"seed",
"path_length",
"path_width",
"path_depth"
],
"text": "--- Generates a 3D maze.\n-- **Algorithm origin:** https://starbeamrainbowlabs.com/blog/article.php?article=posts/070-Language-Review-Lua.html\n-- \n-- The defined region must be at least 3 x 3 x 3 (x, y, z) for a maze to generate.\n-- @param\tpos1\t\t\tVector3\t\tpos1 of the defined region to draw the 3D maze in in.\n-- @param\tpos2\t\t\tVector3\t\tpos2 of the defined region to draw the 3D maze in in.\n-- @param\ttarget_node\t\tstring\t\tThe (normalised) node name to draw the maze in.\n-- @param\tpath_length=2\tnumber\t\tStep this many nodes forwards at once when generating the maze. Higher values create long thin corridors.\n-- @param\tpath_width=1\tnumber\t\tMake all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n-- **Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!\n-- @param\tpath_depth=1\tnumber\t\tMake all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze.\n-- **Caution:** The same warning as with `path_width` applies here also!\n-- @returns\tnumber\t\t\tThe number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).\nfunction worldeditadditions.maze3d(pos1, pos2, target_node, seed, path_length, path_width, path_depth)",
"params": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tpos1 of the defined region to draw the 3D maze in in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to draw the 3D maze in in."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tpos2 of the defined region to draw the 3D maze in in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to draw the 3D maze in in."
},
{
"directive": "param",
"text": "target_node\t\tstring\t\tThe (normalised) node name to draw the maze in.",
"name": "target_node",
"type": "string",
"description": "The (normalised) node name to draw the maze in."
},
{
"directive": "param",
"text": "path_length=2\tnumber\t\tStep this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"name": "path_length",
"type": "number",
"description": "Step this many nodes forwards at once when generating the maze. Higher values create long thin corridors.",
"default_value": "2"
},
{
"directive": "param",
"text": "path_width=1\tnumber\t\tMake all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"name": "path_width",
"type": "number",
"description": "Make all corridors this number of nodes wide when generating the maze. Higher values result in wider corridors.\n**Caution:** Make sure this value is not higher than `path_length - 1`, otherwise the maze algorithm won't work right!",
"default_value": "1"
},
{
"directive": "param",
"text": "path_depth=1\tnumber\t\tMake all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze.\n**Caution:** The same warning as with `path_width` applies here also!",
"name": "path_depth",
"type": "number",
"description": "Make all corridors this number of nodes tall when generating the maze. Higher values results in higher ceilings in the maze.\n**Caution:** The same warning as with `path_width` applies here also!",
"default_value": "1"
}
],
"returns": {
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2).",
"type": "number",
"description": "The number of nodes replaced (i.e. the volume fo the region defined by pos1 and pos2)."
},
"examples": [],
"name_full": "worldeditadditions.maze3d",
"filename": "worldeditadditions/lib/maze3d.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/maze3d.lua#L174-L187"
}
move 🔗
Moves a region to another location, overwriting any nodes at the target location.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source_pos1 | Vector3 | nil | pos1 of the source region to move. |
source_pos2 | Vector3 | nil | pos2 of the source region to move. |
target_pos1 | Vector3 | nil | pos1 of the target region to move to. |
target_pos2 | Vector3 | nil | pos2 of the target region to move to. |
airapply | bool | false | Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not. Caution: If true, then nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location! |
Returns
bool,numbers
:
- Whether the move operation was successful or not
Source
--- Moves a region to another location, overwriting any nodes at the target location.
-- @param source_pos1 Vector3 pos1 of the source region to move.
-- @param source_pos2 Vector3 pos2 of the source region to move.
-- @param target_pos1 Vector3 pos1 of the target region to move to.
-- @param target_pos2 Vector3 pos2 of the target region to move to.
-- @param airapply=false bool Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.
-- **Caution:** If true, then **nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location!**
-- @returns bool,numbers 1. Whether the move operation was successful or not
-- 2. The total number of nodes actually placed in the target region.
function worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_pos2, airapply)
{
"type": "function",
"internal": false,
"description": "Moves a region to another location, overwriting any nodes at the target location.",
"directives": [
{
"directive": "param",
"text": "source_pos1\t\tVector3\t\tpos1 of the source region to move.",
"name": "source_pos1",
"type": "Vector3",
"description": "pos1 of the source region to move."
},
{
"directive": "param",
"text": "source_pos2\t\tVector3\t\tpos2 of the source region to move.",
"name": "source_pos2",
"type": "Vector3",
"description": "pos2 of the source region to move."
},
{
"directive": "param",
"text": "target_pos1\t\tVector3\t\tpos1 of the target region to move to.",
"name": "target_pos1",
"type": "Vector3",
"description": "pos1 of the target region to move to."
},
{
"directive": "param",
"text": "target_pos2\t\tVector3\t\tpos2 of the target region to move to.",
"name": "target_pos2",
"type": "Vector3",
"description": "pos2 of the target region to move to."
},
{
"directive": "param",
"text": "airapply=false\tbool\t\tWhether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.\n**Caution:** If true, then **nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location!**",
"name": "airapply",
"type": "bool",
"description": "Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.\n**Caution:** If true, then **nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location!**",
"default_value": "false"
},
{
"directive": "returns",
"text": "bool,numbers\t1. Whether the move operation was successful or not\n\t\t\t\t\t\t\t2. The total number of nodes actually placed in the target region.",
"type": "bool,numbers",
"description": "1. Whether the move operation was successful or not\n"
}
],
"line": 15,
"namespace": "worldeditadditions",
"line_last": 24,
"name": "move",
"instanced": false,
"args": [
"source_pos1",
"source_pos2",
"target_pos1",
"target_pos2",
"airapply"
],
"text": "--- Moves a region to another location, overwriting any nodes at the target location.\n-- @param\tsource_pos1\t\tVector3\t\tpos1 of the source region to move.\n-- @param\tsource_pos2\t\tVector3\t\tpos2 of the source region to move.\n-- @param\ttarget_pos1\t\tVector3\t\tpos1 of the target region to move to.\n-- @param\ttarget_pos2\t\tVector3\t\tpos2 of the target region to move to.\n-- @param\tairapply=false\tbool\t\tWhether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.\n-- **Caution:** If true, then **nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location!**\n-- @returns\tbool,numbers\t1. Whether the move operation was successful or not\n-- \t\t\t\t\t\t\t2. The total number of nodes actually placed in the target region.\nfunction worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_pos2, airapply)",
"params": [
{
"directive": "param",
"text": "source_pos1\t\tVector3\t\tpos1 of the source region to move.",
"name": "source_pos1",
"type": "Vector3",
"description": "pos1 of the source region to move."
},
{
"directive": "param",
"text": "source_pos2\t\tVector3\t\tpos2 of the source region to move.",
"name": "source_pos2",
"type": "Vector3",
"description": "pos2 of the source region to move."
},
{
"directive": "param",
"text": "target_pos1\t\tVector3\t\tpos1 of the target region to move to.",
"name": "target_pos1",
"type": "Vector3",
"description": "pos1 of the target region to move to."
},
{
"directive": "param",
"text": "target_pos2\t\tVector3\t\tpos2 of the target region to move to.",
"name": "target_pos2",
"type": "Vector3",
"description": "pos2 of the target region to move to."
},
{
"directive": "param",
"text": "airapply=false\tbool\t\tWhether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.\n**Caution:** If true, then **nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location!**",
"name": "airapply",
"type": "bool",
"description": "Whether to only replace target nodes that are air-like, leaving those that are not air-like. If false, then all target nodes are replaced regardless of whether they are air-like nodes or not.\n**Caution:** If true, then **nodes in the source region will be removed and replaced with air, even if they are unable to be placed in the target location!**",
"default_value": "false"
}
],
"returns": {
"directive": "returns",
"text": "bool,numbers\t1. Whether the move operation was successful or not\n\t\t\t\t\t\t\t2. The total number of nodes actually placed in the target region.",
"type": "bool,numbers",
"description": "1. Whether the move operation was successful or not\n"
},
"examples": [],
"name_full": "worldeditadditions.move",
"filename": "worldeditadditions/lib/move.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/move.lua#L16-L25"
}
nodeapply 🔗
Like ellipsoidapply and airapply, but much more flexible, allowing custom sets of nodes to filter changes on. Any changes that don't replace nodes that match the given nodelist will be discarded. Takes a backup copy of the defined region, runs the given function, and then restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position defining the region boundary |
pos2 | Vector3 | nil | The 2nd positioon defining the region boundary |
nodelist | string[] | nil | The nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised! |
func | function | nil | The function to call that performs the action in question. It is expected that the given function will accept no arguments. |
Returns
nil
Source
--- Like ellipsoidapply and airapply, but much more flexible, allowing custom sets of nodes to filter changes on. Any changes that don't replace nodes that match the given nodelist will be discarded.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.
-- @param pos1 Vector3 The 1st position defining the region boundary
-- @param pos2 Vector3 The 2nd positioon defining the region boundary
-- @param nodelist string[] The nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised!
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.nodeapply(pos1, pos2, nodelist, func)
{
"type": "function",
"internal": false,
"description": "Like ellipsoidapply and airapply, but much more flexible, allowing custom sets of nodes to filter changes on. Any changes that don't replace nodes that match the given nodelist will be discarded.\nTakes a backup copy of the defined region, runs the given function, and then\nrestores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "nodelist\tstring[]\tThe nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised!",
"name": "nodelist",
"type": "string[]",
"description": "The nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised!"
},
{
"directive": "param",
"text": "func\t\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"line": 20,
"namespace": "worldeditadditions",
"line_last": 27,
"name": "nodeapply",
"instanced": false,
"args": [
"pos1",
"pos2",
"nodelist",
"func"
],
"text": "--- Like ellipsoidapply and airapply, but much more flexible, allowing custom sets of nodes to filter changes on. Any changes that don't replace nodes that match the given nodelist will be discarded.\n-- Takes a backup copy of the defined region, runs the given function, and then\n-- restores the bits around the edge that aren't inside the largest ellipsoid that will fit inside the defined region.\n-- @param\tpos1\t\tVector3\t\tThe 1st position defining the region boundary\n-- @param\tpos2\t\tVector3\t\tThe 2nd positioon defining the region boundary\n-- @param\tnodelist\tstring[]\tThe nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised!\n-- @param\tfunc\t\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.\nfunction worldeditadditions.nodeapply(pos1, pos2, nodelist, func)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "nodelist\tstring[]\tThe nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised!",
"name": "nodelist",
"type": "string[]",
"description": "The nodelist to match changes against. Any changes that don't replace nodes on this list will be discarded. The following special node names are also accepted: liquid, air. Note that all node names MUST be normalised, otherwise they won't be recognised!"
},
{
"directive": "param",
"text": "func\t\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"examples": [],
"name_full": "worldeditadditions.nodeapply",
"filename": "worldeditadditions/lib/nodeapply.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/nodeapply.lua#L21-L28"
}
noiseapply2d 🔗
Similar to cubeapply, except that it takes 2 positions and randomly keeps changes based on a noise pattern. Takes a backup copy of the defined region, runs the given function, and then restores the bits that aren't above the noise threshold.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position defining the region boundary |
pos2 | Vector3 | nil | The 2nd positioon defining the region boundary |
func | function | nil | The function to call that performs the action in question. It is expected that the given function will accept no arguments. |
Returns
nil
Source
--- Similar to cubeapply, except that it takes 2 positions and randomly keeps changes based on a noise pattern.
-- Takes a backup copy of the defined region, runs the given function, and then
-- restores the bits that aren't above the noise threshold.
-- @param pos1 Vector3 The 1st position defining the region boundary
-- @param pos2 Vector3 The 2nd positioon defining the region boundary
-- @param func function The function to call that performs the action in question. It is expected that the given function will accept no arguments.
function worldeditadditions.noiseapply2d(pos1, pos2, threshold, scale, func)
{
"type": "function",
"internal": false,
"description": "Similar to cubeapply, except that it takes 2 positions and randomly keeps changes based on a noise pattern.\nTakes a backup copy of the defined region, runs the given function, and then\nrestores the bits that aren't above the noise threshold.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "func\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 18,
"name": "noiseapply2d",
"instanced": false,
"args": [
"pos1",
"pos2",
"threshold",
"scale",
"func"
],
"text": "--- Similar to cubeapply, except that it takes 2 positions and randomly keeps changes based on a noise pattern.\n-- Takes a backup copy of the defined region, runs the given function, and then\n-- restores the bits that aren't above the noise threshold.\n-- @param\tpos1\tVector3\t\tThe 1st position defining the region boundary\n-- @param\tpos2\tVector3\t\tThe 2nd positioon defining the region boundary \n-- @param\tfunc\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.\nfunction worldeditadditions.noiseapply2d(pos1, pos2, threshold, scale, func)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe 1st position defining the region boundary",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the region boundary"
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe 2nd positioon defining the region boundary",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the region boundary"
},
{
"directive": "param",
"text": "func\tfunction\tThe function to call that performs the action in question. It is expected that the given function will accept no arguments.",
"name": "func",
"type": "function",
"description": "The function to call that performs the action in question. It is expected that the given function will accept no arguments."
}
],
"examples": [],
"name_full": "worldeditadditions.noiseapply2d",
"filename": "worldeditadditions/lib/noiseapply2d.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/noiseapply2d.lua#L13-L19"
}
overlay 🔗
Overlap command. Places a specified node on top of each column.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to perform the overlay operation in. |
pos2 | Vector3 | nil | pos2 of the defined region to perform the overlay operation in. |
node_weights | table<string,number> | nil | A table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting. Consider it like a ratio. |
Returns
table<string,number|table<number,number>>
:
A table of statistics about the operation performed. | Key
Source
--- Overlap command. Places a specified node on top of each column.
-- @param pos1 Vector3 pos1 of the defined region to perform the overlay operation in.
-- @param pos2 Vector3 pos2 of the defined region to perform the overlay operation in.
-- @param node_weights table<string,number> A table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting.
-- Consider it like a ratio.
-- @returns table<string,number|table<number,number>> A table of statistics about the operation performed.
-- | Key | Value Type | Meaning |
-- |------------|---------------|---------------|
-- | `updated` | number | The number of nodes placed. |
-- | `skipped_columns` | number | The number of columns skipped. This could be because there is no airlike not in that column, or the top node is not airlike. |
-- | `placed` | table<number,number> | A map of node ids to the number of that node that was placed. |
function worldeditadditions.overlay(pos1, pos2, node_weights)
{
"type": "function",
"internal": false,
"description": "Overlap command. Places a specified node on top of each column.",
"directives": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tpos1 of the defined region to perform the overlay operation in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to perform the overlay operation in."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tpos2 of the defined region to perform the overlay operation in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to perform the overlay operation in."
},
{
"directive": "param",
"text": "node_weights\ttable<string,number>\tA table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting.\nConsider it like a ratio.",
"name": "node_weights",
"type": "table<string,number>",
"description": "A table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting.\nConsider it like a ratio."
},
{
"directive": "returns",
"text": "table<string,number|table<number,number>>\tA table of statistics about the operation performed.\n| Key\t\t| Value Type\t| Meaning\t\t|\n|------------|---------------|---------------|\n| `updated`\t| number\t\t| The number of nodes placed. |\n| `skipped_columns` | number\t| The number of columns skipped. This could be because there is no airlike not in that column, or the top node is not airlike. |\n| `placed`\t| table<number,number> | A map of node ids to the number of that node that was placed. |",
"type": "table<string,number|table<number,number>>",
"description": "A table of statistics about the operation performed.\n| Key"
}
],
"line": 6,
"namespace": "worldeditadditions",
"line_last": 17,
"name": "overlay",
"instanced": false,
"args": [
"pos1",
"pos2",
"node_weights"
],
"text": "--- Overlap command. Places a specified node on top of each column.\n-- @param\tpos1\t\t\tVector3\t\tpos1 of the defined region to perform the overlay operation in.\n-- @param\tpos2\t\t\tVector3\t\tpos2 of the defined region to perform the overlay operation in.\n-- @param\tnode_weights\ttable<string,number>\tA table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting.\n-- Consider it like a ratio.\n-- @returns\ttable<string,number|table<number,number>>\tA table of statistics about the operation performed.\n-- | Key\t\t| Value Type\t| Meaning\t\t|\n-- |------------|---------------|---------------|\n-- | `updated`\t| number\t\t| The number of nodes placed. |\n-- | `skipped_columns` | number\t| The number of columns skipped. This could be because there is no airlike not in that column, or the top node is not airlike. |\n-- | `placed`\t| table<number,number> | A map of node ids to the number of that node that was placed. |\nfunction worldeditadditions.overlay(pos1, pos2, node_weights)",
"params": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tpos1 of the defined region to perform the overlay operation in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to perform the overlay operation in."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tpos2 of the defined region to perform the overlay operation in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to perform the overlay operation in."
},
{
"directive": "param",
"text": "node_weights\ttable<string,number>\tA table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting.\nConsider it like a ratio.",
"name": "node_weights",
"type": "table<string,number>",
"description": "A table mapping (normalised) node names to their relative weight. Nodes with a higher weight are placed more often than those with a lower weighting.\nConsider it like a ratio."
}
],
"returns": {
"directive": "returns",
"text": "table<string,number|table<number,number>>\tA table of statistics about the operation performed.\n| Key\t\t| Value Type\t| Meaning\t\t|\n|------------|---------------|---------------|\n| `updated`\t| number\t\t| The number of nodes placed. |\n| `skipped_columns` | number\t| The number of columns skipped. This could be because there is no airlike not in that column, or the top node is not airlike. |\n| `placed`\t| table<number,number> | A map of node ids to the number of that node that was placed. |",
"type": "table<string,number|table<number,number>>",
"description": "A table of statistics about the operation performed.\n| Key"
},
"examples": [],
"name_full": "worldeditadditions.overlay",
"filename": "worldeditadditions/lib/overlay.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/overlay.lua#L7-L18"
}
replacemix 🔗
Like //mix, but replaces a given node instead. TODO: Implement //replacesplat, which picks seeder nodes with a percentage chance, and then some growth passes with e.g. cellular automata? We should probably be pushing towards a release though round about now
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | pos1 of the defined region to replace nodes in. |
pos2 | Vector3 | nil | pos2 of the defined region to replace nodes in. |
target_node | string | nil | The normalised name of the node to replace. |
target_node_chance | number | nil | The chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance. |
replacements | table<string,number> | nil | A map of normalised node names to relative weights for the nodes to replace |
Returns
bool,number,number,table<number,number>
:
- Whether the operation was successful or not.
- The number of nodes actually placed.
- The number of nodes that could have been replaced if
target_node_chance
were set to 1. - A map of node ids to the number of times that node was placed.
Source
--- Like //mix, but replaces a given node instead.
-- TODO: Implement //replacesplat, which picks seeder nodes with a percentage chance, and then some growth passes with e.g. cellular automata? We should probably be pushing towards a release though round about now
-- @param pos1 Vector3 pos1 of the defined region to replace nodes in.
-- @param pos2 Vector3 pos2 of the defined region to replace nodes in.
-- @param target_node string The normalised name of the node to replace.
-- @param target_node_chance number The chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance.
-- @param replacements table<string,number> A map of normalised node names to relative weights for the nodes to replace `target_node` with. Nodes with higher weights will be chosen to replace `target_node` more often.
-- @returns bool,number,number,table<number,number> 1. Whether the operation was successful or not.
-- 2. The number of nodes actually placed.
-- 3. The number of nodes that *could* have been replaced if `target_node_chance` were set to 1.
-- 4. A map of node ids to the number of times that node was placed.
function worldeditadditions.replacemix(pos1, pos2, target_node, target_node_chance, replacements)
{
"type": "function",
"internal": false,
"description": "Like //mix, but replaces a given node instead.\nTODO: Implement //replacesplat, which picks seeder nodes with a percentage chance, and then some growth passes with e.g. cellular automata? We should probably be pushing towards a release though round about now",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to replace nodes in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to replace nodes in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to replace nodes in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to replace nodes in."
},
{
"directive": "param",
"text": "target_node\tstring\t\tThe normalised name of the node to replace.",
"name": "target_node",
"type": "string",
"description": "The normalised name of the node to replace."
},
{
"directive": "param",
"text": "target_node_chance\tnumber\tThe chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance.",
"name": "target_node_chance",
"type": "number",
"description": "The chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance."
},
{
"directive": "param",
"text": "replacements\t\ttable<string,number>\tA map of normalised node names to relative weights for the nodes to replace `target_node` with. Nodes with higher weights will be chosen to replace `target_node` more often.",
"name": "replacements",
"type": "table<string,number>",
"description": "A map of normalised node names to relative weights for the nodes to replace `target_node` with. Nodes with higher weights will be chosen to replace `target_node` more often."
},
{
"directive": "returns",
"text": "bool,number,number,table<number,number>\t\t1. Whether the operation was successful or not.\n2. The number of nodes actually placed.\n3. The number of nodes that *could* have been replaced if `target_node_chance` were set to 1.\n4. A map of node ids to the number of times that node was placed.",
"type": "bool,number,number,table<number,number>",
"description": "1. Whether the operation was successful or not.\n2. The number of nodes actually placed.\n3. The number of nodes that *could* have been replaced if `target_node_chance` were set to 1.\n4. A map of node ids to the number of times that node was placed."
}
],
"line": 13,
"namespace": "worldeditadditions",
"line_last": 24,
"name": "replacemix",
"instanced": false,
"args": [
"pos1",
"pos2",
"target_node",
"target_node_chance",
"replacements"
],
"text": "--- Like //mix, but replaces a given node instead.\n-- TODO: Implement //replacesplat, which picks seeder nodes with a percentage chance, and then some growth passes with e.g. cellular automata? We should probably be pushing towards a release though round about now\n-- @param\tpos1\t\tVector3\t\tpos1 of the defined region to replace nodes in.\n-- @param\tpos2\t\tVector3\t\tpos2 of the defined region to replace nodes in.\n-- @param\ttarget_node\tstring\t\tThe normalised name of the node to replace.\n-- @param\ttarget_node_chance\tnumber\tThe chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance.\n-- @param\treplacements\t\ttable<string,number>\tA map of normalised node names to relative weights for the nodes to replace `target_node` with. Nodes with higher weights will be chosen to replace `target_node` more often.\n-- @returns\tbool,number,number,table<number,number>\t\t1. Whether the operation was successful or not.\n-- 2. The number of nodes actually placed.\n-- 3. The number of nodes that *could* have been replaced if `target_node_chance` were set to 1.\n-- 4. A map of node ids to the number of times that node was placed.\nfunction worldeditadditions.replacemix(pos1, pos2, target_node, target_node_chance, replacements)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tpos1 of the defined region to replace nodes in.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region to replace nodes in."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tpos2 of the defined region to replace nodes in.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region to replace nodes in."
},
{
"directive": "param",
"text": "target_node\tstring\t\tThe normalised name of the node to replace.",
"name": "target_node",
"type": "string",
"description": "The normalised name of the node to replace."
},
{
"directive": "param",
"text": "target_node_chance\tnumber\tThe chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance.",
"name": "target_node_chance",
"type": "number",
"description": "The chance that the target_node should be replaced. This is a 1-in-N chance, so far example a value of 4 would be a 1 in 4 chance of replacement = 25% chance."
},
{
"directive": "param",
"text": "replacements\t\ttable<string,number>\tA map of normalised node names to relative weights for the nodes to replace `target_node` with. Nodes with higher weights will be chosen to replace `target_node` more often.",
"name": "replacements",
"type": "table<string,number>",
"description": "A map of normalised node names to relative weights for the nodes to replace `target_node` with. Nodes with higher weights will be chosen to replace `target_node` more often."
}
],
"returns": {
"directive": "returns",
"text": "bool,number,number,table<number,number>\t\t1. Whether the operation was successful or not.\n2. The number of nodes actually placed.\n3. The number of nodes that *could* have been replaced if `target_node_chance` were set to 1.\n4. A map of node ids to the number of times that node was placed.",
"type": "bool,number,number,table<number,number>",
"description": "1. Whether the operation was successful or not.\n2. The number of nodes actually placed.\n3. The number of nodes that *could* have been replaced if `target_node_chance` were set to 1.\n4. A map of node ids to the number of times that node was placed."
},
"examples": [],
"name_full": "worldeditadditions.replacemix",
"filename": "worldeditadditions/lib/replacemix.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/replacemix.lua#L14-L25"
}
revolve 🔗
Make <times> copies of the region defined by pos1-pos2 at equal angles around a circle. The defined region works best if it's a thin slice that's 1 or 2 blocks thick. For example, if one provided a times value of 3, copies would be rotated 0, 120, and 240 degrees. TODO: implement support to rotate around arbitrary axes. TODO: implement support for stairs, and slabs when we get arbitrary axis rotation support done.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The first position defining the source region. |
pos2 | Vector3 | nil | The second position defining the source region. |
origin | Vector3 | nil | The pivot point to rotate around. |
times | number | nil | The number of equally-spaces copies to make. |
Returns
nil
Source
--- Make <times> copies of the region defined by pos1-pos2 at equal angles around a circle.
-- The defined region works best if it's a thin slice that's 1 or 2 blocks thick.
-- For example, if one provided a times value of 3, copies would be rotated 0, 120, and 240 degrees.
-- TODO: implement support to rotate around arbitrary axes.
-- TODO: implement support for stairs, and slabs when we get arbitrary axis rotation support done.
-- @param pos1 Vector3 The first position defining the source region.
-- @param pos2 Vector3 The second position defining the source region.
-- @param origin Vector3 The pivot point to rotate around.
-- @param times number The number of equally-spaces copies to make.
function worldeditadditions.revolve(pos1, pos2, origin, times)
{
"type": "function",
"internal": false,
"description": "Make <times> copies of the region defined by pos1-pos2 at equal angles around a circle.\nThe defined region works best if it's a thin slice that's 1 or 2 blocks thick.\nFor example, if one provided a times value of 3, copies would be rotated 0, 120, and 240 degrees.\nTODO: implement support to rotate around arbitrary axes.\nTODO: implement support for stairs, and slabs when we get arbitrary axis rotation support done.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe first position defining the source region.",
"name": "pos1",
"type": "Vector3",
"description": "The first position defining the source region."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe second position defining the source region.",
"name": "pos2",
"type": "Vector3",
"description": "The second position defining the source region."
},
{
"directive": "param",
"text": "origin\tVector3\t\tThe pivot point to rotate around.",
"name": "origin",
"type": "Vector3",
"description": "The pivot point to rotate around."
},
{
"directive": "param",
"text": "times\tnumber\t\tThe number of equally-spaces copies to make.",
"name": "times",
"type": "number",
"description": "The number of equally-spaces copies to make."
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 21,
"name": "revolve",
"instanced": false,
"args": [
"pos1",
"pos2",
"origin",
"times"
],
"text": "--- Make <times> copies of the region defined by pos1-pos2 at equal angles around a circle.\n-- The defined region works best if it's a thin slice that's 1 or 2 blocks thick.\n-- For example, if one provided a times value of 3, copies would be rotated 0, 120, and 240 degrees. \n-- TODO: implement support to rotate around arbitrary axes. \n-- TODO: implement support for stairs, and slabs when we get arbitrary axis rotation support done.\n-- @param\tpos1\tVector3\t\tThe first position defining the source region.\n-- @param\tpos2\tVector3\t\tThe second position defining the source region.\n-- @param\torigin\tVector3\t\tThe pivot point to rotate around.\n-- @param\ttimes\tnumber\t\tThe number of equally-spaces copies to make.\nfunction worldeditadditions.revolve(pos1, pos2, origin, times)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe first position defining the source region.",
"name": "pos1",
"type": "Vector3",
"description": "The first position defining the source region."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe second position defining the source region.",
"name": "pos2",
"type": "Vector3",
"description": "The second position defining the source region."
},
{
"directive": "param",
"text": "origin\tVector3\t\tThe pivot point to rotate around.",
"name": "origin",
"type": "Vector3",
"description": "The pivot point to rotate around."
},
{
"directive": "param",
"text": "times\tnumber\t\tThe number of equally-spaces copies to make.",
"name": "times",
"type": "number",
"description": "The number of equally-spaces copies to make."
}
],
"examples": [],
"name_full": "worldeditadditions.revolve",
"filename": "worldeditadditions/lib/revolve.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/revolve.lua#L13-L22"
}
rotate 🔗
Rotates the given region around a given origin point using a set of rotations. TODO Learn quaternions and make this more effiient.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | Position 1 of the defined region to rotate. |
pos2 | Vector3 | nil | Position 2 of the defined region to rotate. |
origin | Vector3 | nil | The coordinates of the origin point around which we should rotate the region defined by pos1..pos2. |
rotlist | table<{axis: string, rad: number}> | nil | The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). |
Returns
bool,string|table<{changed: number}>
:
A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.
Currently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.
This is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region.
Source
--- Rotates the given region around a given origin point using a set of rotations.
-- TODO Learn quaternions and make this more effiient.
-- @param pos1 Vector3 Position 1 of the defined region to rotate.
-- @param pos2 Vector3 Position 2 of the defined region to rotate.
-- @param origin Vector3 The coordinates of the origin point around which we should rotate the region defined by pos1..pos2.
-- @param rotlist table<{axis: string, rad: number}> The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).
-- @returns bool,string|table<{changed: number}> A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.
--
-- Currently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.
--
-- This is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region.
function worldeditadditions.rotate(pos1, pos2, origin, rotlist)
{
"type": "function",
"internal": false,
"description": "Rotates the given region around a given origin point using a set of rotations.\nTODO Learn quaternions and make this more effiient.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 of the defined region to rotate.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 of the defined region to rotate."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 of the defined region to rotate.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 of the defined region to rotate."
},
{
"directive": "param",
"text": "origin\tVector3\t\tThe coordinates of the origin point around which we should rotate the region defined by pos1..pos2.",
"name": "origin",
"type": "Vector3",
"description": "The coordinates of the origin point around which we should rotate the region defined by pos1..pos2."
},
{
"directive": "param",
"text": "rotlist\t\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).",
"name": "rotlist",
"type": "table<{axis: string, rad: number}>",
"description": "The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter)."
},
{
"directive": "returns",
"text": "bool,string|table<{changed: number}>\tA success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.\n\nCurrently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.\n\nThis is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region.",
"type": "bool,string|table<{changed: number}>",
"description": "A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.\n\nCurrently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.\n\nThis is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region."
}
],
"line": 14,
"namespace": "worldeditadditions",
"line_last": 25,
"name": "rotate",
"instanced": false,
"args": [
"pos1",
"pos2",
"origin",
"rotlist"
],
"text": "--- Rotates the given region around a given origin point using a set of rotations.\n-- TODO Learn quaternions and make this more effiient.\n-- @param\tpos1\tVector3\t\tPosition 1 of the defined region to rotate.\n-- @param\tpos2\tVector3\t\tPosition 2 of the defined region to rotate.\n-- @param\torigin\tVector3\t\tThe coordinates of the origin point around which we should rotate the region defined by pos1..pos2.\n-- @param\trotlist\t\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).\n-- @returns\tbool,string|table<{changed: number}>\tA success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.\n-- \n-- Currently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.\n-- \n-- This is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region.\nfunction worldeditadditions.rotate(pos1, pos2, origin, rotlist)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 of the defined region to rotate.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 of the defined region to rotate."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 of the defined region to rotate.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 of the defined region to rotate."
},
{
"directive": "param",
"text": "origin\tVector3\t\tThe coordinates of the origin point around which we should rotate the region defined by pos1..pos2.",
"name": "origin",
"type": "Vector3",
"description": "The coordinates of the origin point around which we should rotate the region defined by pos1..pos2."
},
{
"directive": "param",
"text": "rotlist\t\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).",
"name": "rotlist",
"type": "table<{axis: string, rad: number}>",
"description": "The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter)."
}
],
"returns": {
"directive": "returns",
"text": "bool,string|table<{changed: number}>\tA success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.\n\nCurrently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.\n\nThis is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region.",
"type": "bool,string|table<{changed: number}>",
"description": "A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.\n\nCurrently the only parameter in the statistics table is changed, which is a number representing the number of nodes that were rotated.\n\nThis is NOT NECESSARILY the number of nodes in the target region..... since rotations and roundings mean the target area the source region was rotated into could have slightly more or less nodes than the source region."
},
"examples": [],
"name_full": "worldeditadditions.rotate",
"filename": "worldeditadditions/lib/rotate.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/rotate.lua#L15-L26"
}
scale 🔗
Scales the defined region by the given scale factor in the given anchors. Scale factor vectors containing both scale up and scale down operations are split into 2 different scale operations automatically. Scale up operations are always performed before scale down operations to preserve detail. If performance is important, you should split the scale operations up manually!
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | Position 1 of the defined region, |
pos2 | Vector | nil | Position 2 of the defined region. |
scale | Vector | nil | The scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation). |
anchor | Vector | nil | The anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions. |
Returns
boolean, string|table
:
Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.
Source
--- Scales the defined region by the given scale factor in the given anchors.
-- Scale factor vectors containing both scale up and scale down operations are
-- split into 2 different scale operations automatically.
-- Scale up operations are always performed before scale down operations to
-- preserve detail. If performance is important, you should split the scale
-- operations up manually!
-- @param pos1 Vector Position 1 of the defined region,
-- @param pos2 Vector Position 2 of the defined region.
-- @param scale Vector The scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation).
-- @param anchor Vector The anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions.
-- @return boolean, string|table Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.
function worldeditadditions.scale(pos1, pos2, scale, anchor)
{
"type": "function",
"internal": false,
"description": "Scales the defined region by the given scale factor in the given anchors.\nScale factor vectors containing both scale up and scale down operations are\nsplit into 2 different scale operations automatically.\nScale up operations are always performed before scale down operations to\npreserve detail. If performance is important, you should split the scale\noperations up manually!",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "scale\t\tVector\tThe scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation).",
"name": "scale",
"type": "Vector",
"description": "The scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation)."
},
{
"directive": "param",
"text": "anchor\t\tVector\tThe anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions.",
"name": "anchor",
"type": "Vector",
"description": "The anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions."
},
{
"directive": "returns",
"text": "boolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.",
"type": "boolean, string|table",
"description": "Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead."
}
],
"line": 6,
"namespace": "worldeditadditions",
"line_last": 17,
"name": "scale",
"instanced": false,
"args": [
"pos1",
"pos2",
"scale",
"anchor"
],
"text": "--- Scales the defined region by the given scale factor in the given anchors.\n-- Scale factor vectors containing both scale up and scale down operations are\n-- split into 2 different scale operations automatically.\n-- Scale up operations are always performed before scale down operations to\n-- preserve detail. If performance is important, you should split the scale\n-- operations up manually!\n-- @param\tpos1\t\tVector\tPosition 1 of the defined region,\n-- @param\tpos2\t\tVector\tPosition 2 of the defined region.\n-- @param\tscale\t\tVector\tThe scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation).\n-- @param\tanchor\t\tVector\tThe anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions.\n-- @return\tboolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.\nfunction worldeditadditions.scale(pos1, pos2, scale, anchor)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "scale\t\tVector\tThe scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation).",
"name": "scale",
"type": "Vector",
"description": "The scale factor - as a vector - by which to scale (values between -1 and 1 are considered a scale down operation)."
},
{
"directive": "param",
"text": "anchor\t\tVector\tThe anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions.",
"name": "anchor",
"type": "Vector",
"description": "The anchor to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and negative z directions."
}
],
"returns": {
"directive": "returns",
"text": "boolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.",
"type": "boolean, string|table",
"description": "Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead."
},
"examples": [],
"name_full": "worldeditadditions.scale",
"filename": "worldeditadditions/lib/scale.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/scale.lua#L7-L18"
}
scale_down 🔗
Scales the defined region down by the given scale factor in the given directions. You probably want worldeditadditions.scale, which scales in both directions.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | Position 1 of the defined region, |
pos2 | Vector | nil | Position 2 of the defined region. |
scale | Vector | nil | The scale factor - as a vector - by which to scale down. |
anchor | Vector | nil | The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions. |
Returns
boolean, string|table
:
Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.
Source
--- Scales the defined region down by the given scale factor in the given directions.
-- You probably want worldeditadditions.scale, which scales in both directions.
-- @param pos1 Vector Position 1 of the defined region,
-- @param pos2 Vector Position 2 of the defined region.
-- @param scale Vector The scale factor - as a vector - by which to scale down.
-- @param anchor Vector The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.
-- @return boolean, string|table Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.
function worldeditadditions.scale_down(pos1, pos2, scale, anchor)
{
"type": "function",
"internal": false,
"description": "Scales the defined region down by the given scale factor in the given directions.\nYou probably want worldeditadditions.scale, which scales in both directions.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "scale\t\tVector\tThe scale factor - as a vector - by which to scale down.",
"name": "scale",
"type": "Vector",
"description": "The scale factor - as a vector - by which to scale down."
},
{
"directive": "param",
"text": "anchor\t\tVector\tThe direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.",
"name": "anchor",
"type": "Vector",
"description": "The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions."
},
{
"directive": "returns",
"text": "boolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.",
"type": "boolean, string|table",
"description": "Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead."
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 19,
"name": "scale_down",
"instanced": false,
"args": [
"pos1",
"pos2",
"scale",
"anchor"
],
"text": "--- Scales the defined region down by the given scale factor in the given directions.\n-- You probably want worldeditadditions.scale, which scales in both directions.\n-- @param\tpos1\t\tVector\tPosition 1 of the defined region,\n-- @param\tpos2\t\tVector\tPosition 2 of the defined region.\n-- @param\tscale\t\tVector\tThe scale factor - as a vector - by which to scale down.\n-- @param\tanchor\t\tVector\tThe direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.\n-- @return\tboolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.\nfunction worldeditadditions.scale_down(pos1, pos2, scale, anchor)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "scale\t\tVector\tThe scale factor - as a vector - by which to scale down.",
"name": "scale",
"type": "Vector",
"description": "The scale factor - as a vector - by which to scale down."
},
{
"directive": "param",
"text": "anchor\t\tVector\tThe direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.",
"name": "anchor",
"type": "Vector",
"description": "The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions."
}
],
"returns": {
"directive": "returns",
"text": "boolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.",
"type": "boolean, string|table",
"description": "Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead."
},
"examples": [],
"name_full": "worldeditadditions.scale_down",
"filename": "worldeditadditions/lib/scale_down.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/scale_down.lua#L13-L20"
}
scale_up 🔗
Scales the defined region up by the given scale factor in the given directions. You probably want worldeditadditions.scale, which scales in both directions.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | Position 1 of the defined region, |
pos2 | Vector | nil | Position 2 of the defined region. |
scale | Vector | nil | The scale factor - as a vector - by which to scale down. |
anchor | Vector | nil | The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions. |
Returns
boolean, string|table
:
Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.
Source
--- Scales the defined region up by the given scale factor in the given directions.
-- You probably want worldeditadditions.scale, which scales in both directions.
-- @param pos1 Vector Position 1 of the defined region,
-- @param pos2 Vector Position 2 of the defined region.
-- @param scale Vector The scale factor - as a vector - by which to scale down.
-- @param anchor Vector The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.
-- @return boolean, string|table Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.
function worldeditadditions.scale_up(pos1, pos2, scale, anchor)
{
"type": "function",
"internal": false,
"description": "Scales the defined region up by the given scale factor in the given directions.\nYou probably want worldeditadditions.scale, which scales in both directions.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "scale\t\tVector\tThe scale factor - as a vector - by which to scale down.",
"name": "scale",
"type": "Vector",
"description": "The scale factor - as a vector - by which to scale down."
},
{
"directive": "param",
"text": "anchor\t\tVector\tThe direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.",
"name": "anchor",
"type": "Vector",
"description": "The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions."
},
{
"directive": "returns",
"text": "boolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.",
"type": "boolean, string|table",
"description": "Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead."
}
],
"line": 13,
"namespace": "worldeditadditions",
"line_last": 20,
"name": "scale_up",
"instanced": false,
"args": [
"pos1",
"pos2",
"scale",
"anchor"
],
"text": "--- Scales the defined region up by the given scale factor in the given directions.\n-- You probably want worldeditadditions.scale, which scales in both directions.\n-- @param\tpos1\t\tVector\tPosition 1 of the defined region,\n-- @param\tpos2\t\tVector\tPosition 2 of the defined region.\n-- @param\tscale\t\tVector\tThe scale factor - as a vector - by which to scale down.\n-- @param\tanchor\t\tVector\tThe direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.\n-- @return\tboolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.\nfunction worldeditadditions.scale_up(pos1, pos2, scale, anchor)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "scale\t\tVector\tThe scale factor - as a vector - by which to scale down.",
"name": "scale",
"type": "Vector",
"description": "The scale factor - as a vector - by which to scale down."
},
{
"directive": "param",
"text": "anchor\t\tVector\tThe direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions.",
"name": "anchor",
"type": "Vector",
"description": "The direction to scale in - as a vector. e.g. { x = -1, y = 1, z = -1 } would mean scale in the negative x, positive y, and nevative z directions."
}
],
"returns": {
"directive": "returns",
"text": "boolean, string|table\tWhether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead.",
"type": "boolean, string|table",
"description": "Whether the operation was successful or not. If not, then an error messagea as a string is also passed. If it was, then a statistics object is returned instead."
},
"examples": [],
"name_full": "worldeditadditions.scale_up",
"filename": "worldeditadditions/lib/scale_up.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/scale_up.lua#L14-L21"
}
set 🔗
Sets the given parameter to the given value. This function would pair well with worldeditadditions.nodeapply.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | Position 1 of the define region to operate on. |
pos2 | Vector3 | nil | Position 2 of the define region to operate on. |
param | string="param|param2" | nil | The name of the parameter to set. Currently possible values:
|
value | string|number | nil | The value to set the given parameter to. If |
Returns
bool,table|string
:
true,statistics_table OR false,error_message.
Source
--- Sets the given parameter to the given value.
-- This function would pair well with worldeditadditions.nodeapply.
-- @param pos1 Vector3 Position 1 of the define region to operate on.
-- @param pos2 Vector3 Position 2 of the define region to operate on.
-- @param param string="param|param2" The name of the parameter to set. Currently possible values:
--
-- - **`param`:** Param1, aka the node id.
-- - **`param2`:** The supplementary parameter that each node has. See also <https://api.minetest.net/nodes/#node-paramtypes>. The node type is set by the mod or game that provides each node in question.
-- - **`light`:** Sets the light value of all nodes in the defined region.
-- @param value string|number The value to set the given parameter to. If `param` is set to "param" and `value` is a `string`, then `value` is converted into a number by calling `minetest.get_content_id()`.
-- @returns bool,table|string true,statistics_table OR false,error_message.
function worldeditadditions.set(pos1, pos2, mode, value)
{
"type": "function",
"internal": false,
"description": "Sets the given parameter to the given value.\nThis function would pair well with worldeditadditions.nodeapply.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 of the define region to operate on.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 of the define region to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 of the define region to operate on.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 of the define region to operate on."
},
{
"directive": "param",
"text": "param\tstring=\"param|param2\"\tThe name of the parameter to set. Currently possible values:\n\n- **`param`:** Param1, aka the node id.\n- **`param2`:** The supplementary parameter that each node has. See also <https://api.minetest.net/nodes/#node-paramtypes>. The node type is set by the mod or game that provides each node in question.\n- **`light`:** Sets the light value of all nodes in the defined region.",
"name": "param",
"type": "string=\"param|param2\"",
"description": "The name of the parameter to set. Currently possible values:\n\n- **`param`:** Param1, aka the node id.\n- **`param2`:** The supplementary parameter that each node has. See also <https://api.minetest.net/nodes/#node-paramtypes>. The node type is set by the mod or game that provides each node in question.\n- **`light`:** Sets the light value of all nodes in the defined region."
},
{
"directive": "param",
"text": "value\tstring|number\tThe value to set the given parameter to. If `param` is set to \"param\" and `value` is a `string`, then `value` is converted into a number by calling `minetest.get_content_id()`.",
"name": "value",
"type": "string|number",
"description": "The value to set the given parameter to. If `param` is set to \"param\" and `value` is a `string`, then `value` is converted into a number by calling `minetest.get_content_id()`."
},
{
"directive": "returns",
"text": "bool,table|string\ttrue,statistics_table OR false,error_message.",
"type": "bool,table|string",
"description": "true,statistics_table OR false,error_message."
}
],
"line": 14,
"namespace": "worldeditadditions",
"line_last": 25,
"name": "set",
"instanced": false,
"args": [
"pos1",
"pos2",
"mode",
"value"
],
"text": "--- Sets the given parameter to the given value.\n-- This function would pair well with worldeditadditions.nodeapply.\n-- @param\tpos1\tVector3\t\tPosition 1 of the define region to operate on.\n-- @param\tpos2\tVector3\t\tPosition 2 of the define region to operate on.\n-- @param\tparam\tstring=\"param|param2\"\tThe name of the parameter to set. Currently possible values:\n-- \n-- - **`param`:** Param1, aka the node id.\n-- - **`param2`:** The supplementary parameter that each node has. See also <https://api.minetest.net/nodes/#node-paramtypes>. The node type is set by the mod or game that provides each node in question.\n-- - **`light`:** Sets the light value of all nodes in the defined region.\n-- @param\tvalue\tstring|number\tThe value to set the given parameter to. If `param` is set to \"param\" and `value` is a `string`, then `value` is converted into a number by calling `minetest.get_content_id()`.\n-- @returns\tbool,table|string\ttrue,statistics_table OR false,error_message.\nfunction worldeditadditions.set(pos1, pos2, mode, value)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 of the define region to operate on.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 of the define region to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 of the define region to operate on.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 of the define region to operate on."
},
{
"directive": "param",
"text": "param\tstring=\"param|param2\"\tThe name of the parameter to set. Currently possible values:\n\n- **`param`:** Param1, aka the node id.\n- **`param2`:** The supplementary parameter that each node has. See also <https://api.minetest.net/nodes/#node-paramtypes>. The node type is set by the mod or game that provides each node in question.\n- **`light`:** Sets the light value of all nodes in the defined region.",
"name": "param",
"type": "string=\"param|param2\"",
"description": "The name of the parameter to set. Currently possible values:\n\n- **`param`:** Param1, aka the node id.\n- **`param2`:** The supplementary parameter that each node has. See also <https://api.minetest.net/nodes/#node-paramtypes>. The node type is set by the mod or game that provides each node in question.\n- **`light`:** Sets the light value of all nodes in the defined region."
},
{
"directive": "param",
"text": "value\tstring|number\tThe value to set the given parameter to. If `param` is set to \"param\" and `value` is a `string`, then `value` is converted into a number by calling `minetest.get_content_id()`.",
"name": "value",
"type": "string|number",
"description": "The value to set the given parameter to. If `param` is set to \"param\" and `value` is a `string`, then `value` is converted into a number by calling `minetest.get_content_id()`."
}
],
"returns": {
"directive": "returns",
"text": "bool,table|string\ttrue,statistics_table OR false,error_message.",
"type": "bool,table|string",
"description": "true,statistics_table OR false,error_message."
},
"examples": [],
"name_full": "worldeditadditions.set",
"filename": "worldeditadditions/lib/set.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/set.lua#L15-L26"
}
spiral_circle 🔗
Creates a circular spiral that fills the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position of the defined region. |
pos2 | Vector3 | nil | The 2nd position of the defined region. |
target_node | Vector3 | nil | The normalised name of the node to use to build the square spiral with. |
interval_initial | number | nil | The distance between the walls of the spiral. |
acceleration | number | 0 | Increate the interval by this number every time we hit a corner of the square spiral. |
Returns
bool,number|string
:
A success boolean value, followed by either the number of the nodes set or an error message string.
Source
--- Creates a circular spiral that fills the defined region.
-- @param pos1 Vector3 The 1st position of the defined region.
-- @param pos2 Vector3 The 2nd position of the defined region.
-- @param target_node Vector3 The *normalised* name of the node to use to build the square spiral with.
-- @param interval_initial number The distance between the walls of the spiral.
-- @param acceleration=0 number Increate the interval by this number every time we hit a corner of the square spiral.
-- @returns bool,number|string A success boolean value, followed by either the number of the nodes set or an error message string.
function worldeditadditions.spiral_circle(pos1, pos2, target_node, interval_initial, acceleration)
{
"type": "function",
"internal": false,
"description": "Creates a circular spiral that fills the defined region.",
"directives": [
{
"directive": "param",
"text": "pos1\t\t\t\tVector3\t\tThe 1st position of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position of the defined region."
},
{
"directive": "param",
"text": "pos2\t\t\t\tVector3\t\tThe 2nd position of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd position of the defined region."
},
{
"directive": "param",
"text": "target_node\t\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.",
"name": "target_node",
"type": "Vector3",
"description": "The *normalised* name of the node to use to build the square spiral with."
},
{
"directive": "param",
"text": "interval_initial\tnumber\t\tThe distance between the walls of the spiral.",
"name": "interval_initial",
"type": "number",
"description": "The distance between the walls of the spiral."
},
{
"directive": "param",
"text": "acceleration=0\t\tnumber\t\tIncreate the interval by this number every time we hit a corner of the square spiral.",
"name": "acceleration",
"type": "number",
"description": "Increate the interval by this number every time we hit a corner of the square spiral.",
"default_value": "0"
},
{
"directive": "returns",
"text": "bool,number|string\tA success boolean value, followed by either the number of the nodes set or an error message string.",
"type": "bool,number|string",
"description": "A success boolean value, followed by either the number of the nodes set or an error message string."
}
],
"line": 19,
"namespace": "worldeditadditions",
"line_last": 26,
"name": "spiral_circle",
"instanced": false,
"args": [
"pos1",
"pos2",
"target_node",
"interval_initial",
"acceleration"
],
"text": "--- Creates a circular spiral that fills the defined region.\n-- @param\tpos1\t\t\t\tVector3\t\tThe 1st position of the defined region.\n-- @param\tpos2\t\t\t\tVector3\t\tThe 2nd position of the defined region.\n-- @param\ttarget_node\t\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.\n-- @param\tinterval_initial\tnumber\t\tThe distance between the walls of the spiral.\n-- @param\tacceleration=0\t\tnumber\t\tIncreate the interval by this number every time we hit a corner of the square spiral.\n-- @returns\tbool,number|string\tA success boolean value, followed by either the number of the nodes set or an error message string.\nfunction worldeditadditions.spiral_circle(pos1, pos2, target_node, interval_initial, acceleration)",
"params": [
{
"directive": "param",
"text": "pos1\t\t\t\tVector3\t\tThe 1st position of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position of the defined region."
},
{
"directive": "param",
"text": "pos2\t\t\t\tVector3\t\tThe 2nd position of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd position of the defined region."
},
{
"directive": "param",
"text": "target_node\t\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.",
"name": "target_node",
"type": "Vector3",
"description": "The *normalised* name of the node to use to build the square spiral with."
},
{
"directive": "param",
"text": "interval_initial\tnumber\t\tThe distance between the walls of the spiral.",
"name": "interval_initial",
"type": "number",
"description": "The distance between the walls of the spiral."
},
{
"directive": "param",
"text": "acceleration=0\t\tnumber\t\tIncreate the interval by this number every time we hit a corner of the square spiral.",
"name": "acceleration",
"type": "number",
"description": "Increate the interval by this number every time we hit a corner of the square spiral.",
"default_value": "0"
}
],
"returns": {
"directive": "returns",
"text": "bool,number|string\tA success boolean value, followed by either the number of the nodes set or an error message string.",
"type": "bool,number|string",
"description": "A success boolean value, followed by either the number of the nodes set or an error message string."
},
"examples": [],
"name_full": "worldeditadditions.spiral_circle",
"filename": "worldeditadditions/lib/spiral_circle.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/spiral_circle.lua#L20-L27"
}
spiral_square 🔗
Creates a square spiral that fills the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position of the defined region. |
pos2 | Vector3 | nil | The 2nd position of the defined region. |
target_node | Vector3 | nil | The normalised name of the node to use to build the square spiral with. |
interval | number | nil | The distance between the walls of the spiral. |
acceleration | number | 0 | Increate the interval by this number every time we hit a corner of the square spiral. |
Returns
bool,number|string
:
A success boolean value, followed by either the number of the nodes set or an error message string.
Source
--- Creates a square spiral that fills the defined region.
-- @param pos1 Vector3 The 1st position of the defined region.
-- @param pos2 Vector3 The 2nd position of the defined region.
-- @param target_node Vector3 The *normalised* name of the node to use to build the square spiral with.
-- @param interval number The distance between the walls of the spiral.
-- @param acceleration=0 number Increate the interval by this number every time we hit a corner of the square spiral.
-- @returns bool,number|string A success boolean value, followed by either the number of the nodes set or an error message string.
function worldeditadditions.spiral_square(pos1, pos2, target_node, interval, acceleration)
{
"type": "function",
"internal": false,
"description": "Creates a square spiral that fills the defined region.",
"directives": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tThe 1st position of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position of the defined region."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tThe 2nd position of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd position of the defined region."
},
{
"directive": "param",
"text": "target_node\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.",
"name": "target_node",
"type": "Vector3",
"description": "The *normalised* name of the node to use to build the square spiral with."
},
{
"directive": "param",
"text": "interval\t\tnumber\t\tThe distance between the walls of the spiral.",
"name": "interval",
"type": "number",
"description": "The distance between the walls of the spiral."
},
{
"directive": "param",
"text": "acceleration=0\tnumber\t\tIncreate the interval by this number every time we hit a corner of the square spiral.",
"name": "acceleration",
"type": "number",
"description": "Increate the interval by this number every time we hit a corner of the square spiral.",
"default_value": "0"
},
{
"directive": "returns",
"text": "bool,number|string\t\t\tA success boolean value, followed by either the number of the nodes set or an error message string.",
"type": "bool,number|string",
"description": "A success boolean value, followed by either the number of the nodes set or an error message string."
}
],
"line": 19,
"namespace": "worldeditadditions",
"line_last": 26,
"name": "spiral_square",
"instanced": false,
"args": [
"pos1",
"pos2",
"target_node",
"interval",
"acceleration"
],
"text": "--- Creates a square spiral that fills the defined region.\n-- @param\tpos1\t\t\tVector3\t\tThe 1st position of the defined region.\n-- @param\tpos2\t\t\tVector3\t\tThe 2nd position of the defined region.\n-- @param\ttarget_node\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.\n-- @param\tinterval\t\tnumber\t\tThe distance between the walls of the spiral.\n-- @param\tacceleration=0\tnumber\t\tIncreate the interval by this number every time we hit a corner of the square spiral.\n-- @returns\tbool,number|string\t\t\tA success boolean value, followed by either the number of the nodes set or an error message string.\nfunction worldeditadditions.spiral_square(pos1, pos2, target_node, interval, acceleration)",
"params": [
{
"directive": "param",
"text": "pos1\t\t\tVector3\t\tThe 1st position of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position of the defined region."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\t\tThe 2nd position of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd position of the defined region."
},
{
"directive": "param",
"text": "target_node\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.",
"name": "target_node",
"type": "Vector3",
"description": "The *normalised* name of the node to use to build the square spiral with."
},
{
"directive": "param",
"text": "interval\t\tnumber\t\tThe distance between the walls of the spiral.",
"name": "interval",
"type": "number",
"description": "The distance between the walls of the spiral."
},
{
"directive": "param",
"text": "acceleration=0\tnumber\t\tIncreate the interval by this number every time we hit a corner of the square spiral.",
"name": "acceleration",
"type": "number",
"description": "Increate the interval by this number every time we hit a corner of the square spiral.",
"default_value": "0"
}
],
"returns": {
"directive": "returns",
"text": "bool,number|string\t\t\tA success boolean value, followed by either the number of the nodes set or an error message string.",
"type": "bool,number|string",
"description": "A success boolean value, followed by either the number of the nodes set or an error message string."
},
"examples": [],
"name_full": "worldeditadditions.spiral_square",
"filename": "worldeditadditions/lib/spiral_square.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/spiral_square.lua#L20-L27"
}
spline 🔗
Creates a spline that follows the given list of points.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos_list | Vector3[] | nil | The list of points that define the path the spline should follow. Minimum: 2 |
width_start | number | nil | The width of the spline at the start. |
width_end | number | nil | The width of the spline at the end. If nil, then width_start is used. |
steps | number | nil | The number of smoothing passes to apply to the list of points. |
target_node | Vector3 | nil | The normalised name of the node to use to build the square spiral with. |
Returns
bool,number|string
:
A success boolean value, followed by either the number of the nodes set or an error message string.
Source
--- Creates a spline that follows the given list of points.
-- @param pos_list Vector3[] The list of points that define the path the spline should follow. Minimum: 2
-- @param width_start number The width of the spline at the start.
-- @param width_end number The width of the spline at the end. If nil, then width_start is used.
-- @param steps number The number of smoothing passes to apply to the list of points.
-- @param target_node Vector3 The *normalised* name of the node to use to build the square spiral with.
-- @returns bool,number|string A success boolean value, followed by either the number of the nodes set or an error message string.
function worldeditadditions.spline(pos_list, width_start, width_end, steps, target_node)
{
"type": "function",
"internal": false,
"description": "Creates a spline that follows the given list of points.",
"directives": [
{
"directive": "param",
"text": "pos_list\t\tVector3[]\tThe list of points that define the path the spline should follow. Minimum: 2",
"name": "pos_list",
"type": "Vector3[]",
"description": "The list of points that define the path the spline should follow. Minimum: 2"
},
{
"directive": "param",
"text": "width_start\t\tnumber\tThe width of the spline at the start.",
"name": "width_start",
"type": "number",
"description": "The width of the spline at the start."
},
{
"directive": "param",
"text": "width_end\t\tnumber\tThe width of the spline at the end. If nil, then width_start is used.",
"name": "width_end",
"type": "number",
"description": "The width of the spline at the end. If nil, then width_start is used."
},
{
"directive": "param",
"text": "steps\t\t\tnumber\t\tThe number of smoothing passes to apply to the list of points.",
"name": "steps",
"type": "number",
"description": "The number of smoothing passes to apply to the list of points."
},
{
"directive": "param",
"text": "target_node\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.",
"name": "target_node",
"type": "Vector3",
"description": "The *normalised* name of the node to use to build the square spiral with."
},
{
"directive": "returns",
"text": "bool,number|string\t\t\tA success boolean value, followed by either the number of the nodes set or an error message string.",
"type": "bool,number|string",
"description": "A success boolean value, followed by either the number of the nodes set or an error message string."
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 19,
"name": "spline",
"instanced": false,
"args": [
"pos_list",
"width_start",
"width_end",
"steps",
"target_node"
],
"text": "--- Creates a spline that follows the given list of points.\n-- @param\tpos_list\t\tVector3[]\tThe list of points that define the path the spline should follow. Minimum: 2\n-- @param\twidth_start\t\tnumber\tThe width of the spline at the start.\n-- @param\twidth_end\t\tnumber\tThe width of the spline at the end. If nil, then width_start is used.\n-- @param\tsteps\t\t\tnumber\t\tThe number of smoothing passes to apply to the list of points.\n-- @param\ttarget_node\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.\n-- @returns\tbool,number|string\t\t\tA success boolean value, followed by either the number of the nodes set or an error message string.\nfunction worldeditadditions.spline(pos_list, width_start, width_end, steps, target_node)",
"params": [
{
"directive": "param",
"text": "pos_list\t\tVector3[]\tThe list of points that define the path the spline should follow. Minimum: 2",
"name": "pos_list",
"type": "Vector3[]",
"description": "The list of points that define the path the spline should follow. Minimum: 2"
},
{
"directive": "param",
"text": "width_start\t\tnumber\tThe width of the spline at the start.",
"name": "width_start",
"type": "number",
"description": "The width of the spline at the start."
},
{
"directive": "param",
"text": "width_end\t\tnumber\tThe width of the spline at the end. If nil, then width_start is used.",
"name": "width_end",
"type": "number",
"description": "The width of the spline at the end. If nil, then width_start is used."
},
{
"directive": "param",
"text": "steps\t\t\tnumber\t\tThe number of smoothing passes to apply to the list of points.",
"name": "steps",
"type": "number",
"description": "The number of smoothing passes to apply to the list of points."
},
{
"directive": "param",
"text": "target_node\t\tVector3\t\tThe *normalised* name of the node to use to build the square spiral with.",
"name": "target_node",
"type": "Vector3",
"description": "The *normalised* name of the node to use to build the square spiral with."
}
],
"returns": {
"directive": "returns",
"text": "bool,number|string\t\t\tA success boolean value, followed by either the number of the nodes set or an error message string.",
"type": "bool,number|string",
"description": "A success boolean value, followed by either the number of the nodes set or an error message string."
},
"examples": [],
"name_full": "worldeditadditions.spline",
"filename": "worldeditadditions/lib/spline.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/spline.lua#L13-L20"
}
subdivide 🔗
Calls the given callback function once for each block in the defined area. This function is asynchronous, as it also uses minetest.emerge_area() to ensure that the blocks are loaded before calling the callback function. The callback functions will be passed the following arguments: pos1, pos2, stats pos1 and pos2 refer to the defined region of just the local block. stats is an table of statistics resembling the following: { chunks_completed, chunks_total, emerge = { ... }, times = { emerge = {}, emerge_last, callback = {}, callback_last, steps = {}, step_last } } The emerge property contains a table that holds a running total of statistics about what Minetest did to emerge the requested blocks in the world. callback_complete is called at the end of the process, and pos1 + pos2 will be set to that of the entire region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | The first position defining the area to emerge. |
pos2 | Vector | nil | The second position defining the area to emerge. |
chunk_size | Vector | nil | The size of the chunks to subdivide into. |
callback | function | nil | The callback to call for each block. |
callback | function | nil | The callback to call upon completion. |
Returns
nil
Source
--- Calls the given callback function once for each block in the defined area.
-- This function is asynchronous, as it also uses minetest.emerge_area() to
-- ensure that the blocks are loaded before calling the callback function.
-- The callback functions will be passed the following arguments: pos1, pos2, stats
-- pos1 and pos2 refer to the defined region of just the local block.
-- stats is an table of statistics resembling the following:
-- { chunks_completed, chunks_total, emerge = { ... }, times = { emerge = {}, emerge_last, callback = {}, callback_last, steps = {}, step_last } }
-- The emerge property contains a table that holds a running total of statistics
-- about what Minetest did to emerge the requested blocks in the world.
-- callback_complete is called at the end of the process, and pos1 + pos2 will be set to that of the entire region.
-- @param pos1 Vector The first position defining the area to emerge.
-- @param pos2 Vector The second position defining the area to emerge.
-- @param chunk_size Vector The size of the chunks to subdivide into.
-- @param callback function The callback to call for each block.
-- @param callback function The callback to call upon completion.
function worldeditadditions.subdivide(pos1, pos2, chunk_size, callback_subblock, callback_complete)
{
"type": "function",
"internal": false,
"description": "Calls the given callback function once for each block in the defined area.\nThis function is asynchronous, as it also uses minetest.emerge_area() to\nensure that the blocks are loaded before calling the callback function.\nThe callback functions will be passed the following arguments: pos1, pos2, stats\npos1 and pos2 refer to the defined region of just the local block.\nstats is an table of statistics resembling the following:\n{ chunks_completed, chunks_total, emerge = { ... }, times = { emerge = {}, emerge_last, callback = {}, callback_last, steps = {}, step_last } }\nThe emerge property contains a table that holds a running total of statistics\nabout what Minetest did to emerge the requested blocks in the world.\ncallback_complete is called at the end of the process, and pos1 + pos2 will be set to that of the entire region.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector\t\tThe first position defining the area to emerge.",
"name": "pos1",
"type": "Vector",
"description": "The first position defining the area to emerge."
},
{
"directive": "param",
"text": "pos2\t\tVector\t\tThe second position defining the area to emerge.",
"name": "pos2",
"type": "Vector",
"description": "The second position defining the area to emerge."
},
{
"directive": "param",
"text": "chunk_size\tVector\t\tThe size of the chunks to subdivide into.",
"name": "chunk_size",
"type": "Vector",
"description": "The size of the chunks to subdivide into."
},
{
"directive": "param",
"text": "callback\tfunction\tThe callback to call for each block.",
"name": "callback",
"type": "function",
"description": "The callback to call for each block."
},
{
"directive": "param",
"text": "callback\tfunction\tThe callback to call upon completion.",
"name": "callback",
"type": "function",
"description": "The callback to call upon completion."
}
],
"line": 137,
"namespace": "worldeditadditions",
"line_last": 152,
"name": "subdivide",
"instanced": false,
"args": [
"pos1",
"pos2",
"chunk_size",
"callback_subblock",
"callback_complete"
],
"text": "--- Calls the given callback function once for each block in the defined area.\n-- This function is asynchronous, as it also uses minetest.emerge_area() to\n-- ensure that the blocks are loaded before calling the callback function.\n-- The callback functions will be passed the following arguments: pos1, pos2, stats\n-- pos1 and pos2 refer to the defined region of just the local block.\n-- stats is an table of statistics resembling the following:\n-- { chunks_completed, chunks_total, emerge = { ... }, times = { emerge = {}, emerge_last, callback = {}, callback_last, steps = {}, step_last } }\n-- The emerge property contains a table that holds a running total of statistics\n-- about what Minetest did to emerge the requested blocks in the world.\n-- callback_complete is called at the end of the process, and pos1 + pos2 will be set to that of the entire region.\n-- @param\tpos1\t\tVector\t\tThe first position defining the area to emerge.\n-- @param\tpos2\t\tVector\t\tThe second position defining the area to emerge.\n-- @param\tchunk_size\tVector\t\tThe size of the chunks to subdivide into.\n-- @param\tcallback\tfunction\tThe callback to call for each block.\n-- @param\tcallback\tfunction\tThe callback to call upon completion.\nfunction worldeditadditions.subdivide(pos1, pos2, chunk_size, callback_subblock, callback_complete)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector\t\tThe first position defining the area to emerge.",
"name": "pos1",
"type": "Vector",
"description": "The first position defining the area to emerge."
},
{
"directive": "param",
"text": "pos2\t\tVector\t\tThe second position defining the area to emerge.",
"name": "pos2",
"type": "Vector",
"description": "The second position defining the area to emerge."
},
{
"directive": "param",
"text": "chunk_size\tVector\t\tThe size of the chunks to subdivide into.",
"name": "chunk_size",
"type": "Vector",
"description": "The size of the chunks to subdivide into."
},
{
"directive": "param",
"text": "callback\tfunction\tThe callback to call for each block.",
"name": "callback",
"type": "function",
"description": "The callback to call for each block."
},
{
"directive": "param",
"text": "callback\tfunction\tThe callback to call upon completion.",
"name": "callback",
"type": "function",
"description": "The callback to call upon completion."
}
],
"examples": [],
"name_full": "worldeditadditions.subdivide",
"filename": "worldeditadditions/lib/subdivide.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/subdivide.lua#L138-L153"
}
torus 🔗
Generates a torus shape at the given position with the given parameters.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
position | Vector | nil | The position at which to generate the torus. |
major_radius | number | nil | The major radius of the torus - i.e. the distance from the middle to the ring. |
minor_radius | number | nil | The minor radius of the torus - i.e. the radius fo the ring itself. |
target_node | string | nil | The name of the target node to generate the torus with. |
axes | string|nil | xz | The axes upon which the torus should lay flat. |
hollow | boolean | false | Whether the generated torus should be hollow or not. |
Returns
number
:
The number of nodes replaced.
Source
--- Generates a torus shape at the given position with the given parameters.
-- @param position Vector The position at which to generate the torus.
-- @param major_radius number The major radius of the torus - i.e. the distance from the middle to the ring.
-- @param minor_radius number The minor radius of the torus - i.e. the radius fo the ring itself.
-- @param target_node string The name of the target node to generate the torus with.
-- @param axes=xz string|nil The axes upon which the torus should lay flat.
-- @param hollow=false boolean Whether the generated torus should be hollow or not.
-- @returns number The number of nodes replaced.
function worldeditadditions.torus(position, major_radius, minor_radius, target_node, axes, hollow)
{
"type": "function",
"internal": false,
"description": "Generates a torus shape at the given position with the given parameters.",
"directives": [
{
"directive": "param",
"text": "position\t\tVector\t\tThe position at which to generate the torus.",
"name": "position",
"type": "Vector",
"description": "The position at which to generate the torus."
},
{
"directive": "param",
"text": "major_radius\tnumber\t\tThe major radius of the torus - i.e. the distance from the middle to the ring.",
"name": "major_radius",
"type": "number",
"description": "The major radius of the torus - i.e. the distance from the middle to the ring."
},
{
"directive": "param",
"text": "minor_radius\tnumber\t\tThe minor radius of the torus - i.e. the radius fo the ring itself.",
"name": "minor_radius",
"type": "number",
"description": "The minor radius of the torus - i.e. the radius fo the ring itself."
},
{
"directive": "param",
"text": "target_node\t\tstring\t\tThe name of the target node to generate the torus with.",
"name": "target_node",
"type": "string",
"description": "The name of the target node to generate the torus with."
},
{
"directive": "param",
"text": "axes=xz\t\t\tstring|nil\tThe axes upon which the torus should lay flat.",
"name": "axes",
"type": "string|nil",
"description": "The axes upon which the torus should lay flat.",
"default_value": "xz"
},
{
"directive": "param",
"text": "hollow=false\tboolean\t\tWhether the generated torus should be hollow or not.",
"name": "hollow",
"type": "boolean",
"description": "Whether the generated torus should be hollow or not.",
"default_value": "false"
},
{
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced.",
"type": "number",
"description": "The number of nodes replaced."
}
],
"line": 6,
"namespace": "worldeditadditions",
"line_last": 14,
"name": "torus",
"instanced": false,
"args": [
"position",
"major_radius",
"minor_radius",
"target_node",
"axes",
"hollow"
],
"text": "--- Generates a torus shape at the given position with the given parameters.\n-- @param\tposition\t\tVector\t\tThe position at which to generate the torus.\n-- @param\tmajor_radius\tnumber\t\tThe major radius of the torus - i.e. the distance from the middle to the ring.\n-- @param\tminor_radius\tnumber\t\tThe minor radius of the torus - i.e. the radius fo the ring itself.\n-- @param\ttarget_node\t\tstring\t\tThe name of the target node to generate the torus with.\n-- @param\taxes=xz\t\t\tstring|nil\tThe axes upon which the torus should lay flat.\n-- @param\thollow=false\tboolean\t\tWhether the generated torus should be hollow or not.\n-- @returns\tnumber\t\t\tThe number of nodes replaced.\nfunction worldeditadditions.torus(position, major_radius, minor_radius, target_node, axes, hollow)",
"params": [
{
"directive": "param",
"text": "position\t\tVector\t\tThe position at which to generate the torus.",
"name": "position",
"type": "Vector",
"description": "The position at which to generate the torus."
},
{
"directive": "param",
"text": "major_radius\tnumber\t\tThe major radius of the torus - i.e. the distance from the middle to the ring.",
"name": "major_radius",
"type": "number",
"description": "The major radius of the torus - i.e. the distance from the middle to the ring."
},
{
"directive": "param",
"text": "minor_radius\tnumber\t\tThe minor radius of the torus - i.e. the radius fo the ring itself.",
"name": "minor_radius",
"type": "number",
"description": "The minor radius of the torus - i.e. the radius fo the ring itself."
},
{
"directive": "param",
"text": "target_node\t\tstring\t\tThe name of the target node to generate the torus with.",
"name": "target_node",
"type": "string",
"description": "The name of the target node to generate the torus with."
},
{
"directive": "param",
"text": "axes=xz\t\t\tstring|nil\tThe axes upon which the torus should lay flat.",
"name": "axes",
"type": "string|nil",
"description": "The axes upon which the torus should lay flat.",
"default_value": "xz"
},
{
"directive": "param",
"text": "hollow=false\tboolean\t\tWhether the generated torus should be hollow or not.",
"name": "hollow",
"type": "boolean",
"description": "Whether the generated torus should be hollow or not.",
"default_value": "false"
}
],
"returns": {
"directive": "returns",
"text": "number\t\t\tThe number of nodes replaced.",
"type": "number",
"description": "The number of nodes replaced."
},
"examples": [],
"name_full": "worldeditadditions.torus",
"filename": "worldeditadditions/lib/torus.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/torus.lua#L7-L15"
}
🔗
Re-orients the nodes in the given region around a given origin point using a set of rotations. TODO Learn quaternions and make this more effiient.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | Position 1 of the region to orient nodes in. |
pos2 | Vector3 | nil | Position 2 of the region to orient nodes in. |
rotlist | table<{axis: string, rad: number}> | nil | The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). |
Returns
bool,string|table<{changed: number}>
:
A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.
Source
--- Re-orients the nodes in the given region around a given origin point using a set of rotations.
-- TODO Learn quaternions and make this more effiient.
-- @param pos1 Vector3 Position 1 of the region to orient nodes in.
-- @param pos2 Vector3 Position 2 of the region to orient nodes in.
-- @param rotlist table<{axis: string, rad: number}> The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).
-- @returns bool,string|table<{changed: number}> A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.
--
{
"type": "function",
"internal": false,
"description": "Re-orients the nodes in the given region around a given origin point using a set of rotations.\nTODO Learn quaternions and make this more effiient.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 of the region to orient nodes in.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 of the region to orient nodes in."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 of the region to orient nodes in.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 of the region to orient nodes in."
},
{
"directive": "param",
"text": "rotlist\t\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).",
"name": "rotlist",
"type": "table<{axis: string, rad: number}>",
"description": "The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter)."
},
{
"directive": "returns",
"text": "bool,string|table<{changed: number}>\tA success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.",
"type": "bool,string|table<{changed: number}>",
"description": "A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true."
}
],
"line": 16,
"namespace": "worldeditadditions",
"line_last": 22,
"text": "--- Re-orients the nodes in the given region around a given origin point using a set of rotations.\n-- TODO Learn quaternions and make this more effiient.\n-- @param\tpos1\tVector3\t\tPosition 1 of the region to orient nodes in.\n-- @param\tpos2\tVector3\t\tPosition 2 of the region to orient nodes in.\n-- @param\trotlist\t\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).\n-- @returns\tbool,string|table<{changed: number}>\tA success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.\n--",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 of the region to orient nodes in.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 of the region to orient nodes in."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 of the region to orient nodes in.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 of the region to orient nodes in."
},
{
"directive": "param",
"text": "rotlist\t\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter).",
"name": "rotlist",
"type": "table<{axis: string, rad: number}>",
"description": "The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter)."
}
],
"returns": {
"directive": "returns",
"text": "bool,string|table<{changed: number}>\tA success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true.",
"type": "bool,string|table<{changed: number}>",
"description": "A success boolean (true == success; false == failure), followed by either an error message as a string if success == false or a table of statistics if success == true."
},
"examples": [],
"name_full": "worldeditadditions.undefined",
"filename": "worldeditadditions/lib/orient.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/orient.lua#L17-L23"
}
walls 🔗
Creates vertical walls on the inside of the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | Position 1 of the defined region, |
pos2 | Vector | nil | Position 2 of the defined region. |
node_name | string | nil | The name of the node to use to create the walls with. |
thickness | number? | nil | The thickness of the walls to create. Default: 1 |
Returns
nil
Source
--- Creates vertical walls on the inside of the defined region.
-- @apipath worldeditadditions.walls
-- @param pos1 Vector Position 1 of the defined region,
-- @param pos2 Vector Position 2 of the defined region.
-- @param node_name string The name of the node to use to create the walls with.
-- @param thickness number? The thickness of the walls to create. Default: 1
function worldeditadditions.walls(pos1, pos2, node_name, thickness)
{
"type": "function",
"internal": false,
"description": "Creates vertical walls on the inside of the defined region.",
"directives": [
{
"directive": "apipath",
"text": "worldeditadditions.walls"
},
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "node_name\tstring\tThe name of the node to use to create the walls with.",
"name": "node_name",
"type": "string",
"description": "The name of the node to use to create the walls with."
},
{
"directive": "param",
"text": "thickness\tnumber?\tThe thickness of the walls to create. Default: 1",
"name": "thickness",
"type": "number?",
"description": "The thickness of the walls to create. Default: 1"
}
],
"line": 12,
"namespace": "worldeditadditions",
"line_last": 18,
"name": "walls",
"instanced": false,
"args": [
"pos1",
"pos2",
"node_name",
"thickness"
],
"text": "--- Creates vertical walls on the inside of the defined region.\n-- @apipath worldeditadditions.walls\n-- @param\tpos1\t\tVector\tPosition 1 of the defined region,\n-- @param\tpos2\t\tVector\tPosition 2 of the defined region.\n-- @param\tnode_name\tstring\tThe name of the node to use to create the walls with.\n-- @param\tthickness\tnumber?\tThe thickness of the walls to create. Default: 1\nfunction worldeditadditions.walls(pos1, pos2, node_name, thickness)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector\tPosition 1 of the defined region,",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the defined region,"
},
{
"directive": "param",
"text": "pos2\t\tVector\tPosition 2 of the defined region.",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the defined region."
},
{
"directive": "param",
"text": "node_name\tstring\tThe name of the node to use to create the walls with.",
"name": "node_name",
"type": "string",
"description": "The name of the node to use to create the walls with."
},
{
"directive": "param",
"text": "thickness\tnumber?\tThe thickness of the walls to create. Default: 1",
"name": "thickness",
"type": "number?",
"description": "The thickness of the walls to create. Default: 1"
}
],
"examples": [],
"name_full": "worldeditadditions.walls",
"filename": "worldeditadditions/lib/walls.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/walls.lua#L13-L19"
}
wire_box 🔗
Fills the edges of the selection box with nodes.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The 1st position defining the WorldEdit selection |
pos2 | Vector3 | nil | The 2nd positioon defining the WorldEdit selection |
node | string | nil | Name of the node to place |
Returns
nil
Source
--- Fills the edges of the selection box with nodes.
-- @param pos1 Vector3 The 1st position defining the WorldEdit selection
-- @param pos2 Vector3 The 2nd positioon defining the WorldEdit selection
-- @param node string Name of the node to place
function worldeditadditions.wire_box(pos1,pos2,node)
{
"type": "function",
"internal": false,
"description": "Fills the edges of the selection box with nodes.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\tThe 1st position defining the WorldEdit selection",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the WorldEdit selection"
},
{
"directive": "param",
"text": "pos2\tVector3\tThe 2nd positioon defining the WorldEdit selection",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the WorldEdit selection"
},
{
"directive": "param",
"text": "node\tstring\tName of the node to place",
"name": "node",
"type": "string",
"description": "Name of the node to place"
}
],
"line": 11,
"namespace": "worldeditadditions",
"line_last": 15,
"name": "wire_box",
"instanced": false,
"args": [
"pos1",
"pos2",
"node"
],
"text": "--- Fills the edges of the selection box with nodes.\n-- @param\tpos1\tVector3\tThe 1st position defining the WorldEdit selection\n-- @param\tpos2\tVector3\tThe 2nd positioon defining the WorldEdit selection\n-- @param\tnode\tstring\tName of the node to place\nfunction worldeditadditions.wire_box(pos1,pos2,node)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\tThe 1st position defining the WorldEdit selection",
"name": "pos1",
"type": "Vector3",
"description": "The 1st position defining the WorldEdit selection"
},
{
"directive": "param",
"text": "pos2\tVector3\tThe 2nd positioon defining the WorldEdit selection",
"name": "pos2",
"type": "Vector3",
"description": "The 2nd positioon defining the WorldEdit selection"
},
{
"directive": "param",
"text": "node\tstring\tName of the node to place",
"name": "node",
"type": "string",
"description": "Name of the node to place"
}
],
"examples": [],
"name_full": "worldeditadditions.wire_box",
"filename": "worldeditadditions/lib/wireframe/wire_box.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions/lib/wireframe/wire_box.lua#L12-L16"
}
worldeditadditions_commands 🔗
WorldEditAdditions-ChatCommands
worldeditadditions_core 🔗
WorldEditAdditions chat command registration
entities 🔗
Entities and functions to manage them.
pos_marker_wall 🔗
Functions
check_entity 🔗
Checks the given entity for whether it's in the current generation of wall markers or not. Only entities of type worldeditadditions:marker_wall will be removed.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
entity | ObjectRef | nil | The entity to check. |
Returns
nil
Source
--- Checks the given entity for whether it's in the current generation of wall markers or not.
-- Only entities of type worldeditadditions:marker_wall will be removed.
-- @param entity ObjectRef The entity to check.
local function check_entity(entity)
{
"type": "function",
"internal": false,
"description": "Checks the given entity for whether it's in the current generation of wall markers or not.\nOnly entities of type worldeditadditions:marker_wall will be removed.",
"directives": [
{
"directive": "param",
"text": "entity\tObjectRef\tThe entity to check.",
"name": "entity",
"type": "ObjectRef",
"description": "The entity to check."
}
],
"line": 94,
"namespace": "worldeditadditions_core.entities.pos_marker_wall",
"line_last": 97,
"name": "check_entity",
"instanced": false,
"args": [
"entity"
],
"text": "--- Checks the given entity for whether it's in the current generation of wall markers or not.\n-- Only entities of type worldeditadditions:marker_wall will be removed.\n-- @param\tentity\tObjectRef\tThe entity to check.\nlocal function check_entity(entity)",
"params": [
{
"directive": "param",
"text": "entity\tObjectRef\tThe entity to check.",
"name": "entity",
"type": "ObjectRef",
"description": "The entity to check."
}
],
"examples": [],
"name_full": "worldeditadditions_core.entities.pos_marker_wall.check_entity",
"filename": "worldeditadditions_core/core/entities/pos_marker_wall.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/entities/pos_marker_wall.lua#L95-L98"
}
create_single 🔗
Creates a single marker wall entity.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player it should belong to. |
pos1 | Vector3 | nil | The pos1 corner of the area the SINGLE marker should cover. |
pos2 | Vector3 | nil | The pos2 corner of the area the SINGLE marker should cover. |
side | string | nil | The side that this wall is on. Valid values: x, -x, y, -y, z, -z. |
Returns
Entity<WEAPositionMarkerWall>
Source
--- Creates a single marker wall entity.
-- @param player_name string The name of the player it should belong to.
-- @param pos1 Vector3 The pos1 corner of the area the SINGLE marker should cover.
-- @param pos2 Vector3 The pos2 corner of the area the SINGLE marker should cover.
-- @param side string The side that this wall is on. Valid values: x, -x, y, -y, z, -z.
-- @returns Entity<WEAPositionMarkerWall>
local function create_single(player_name, pos1, pos2, side)
{
"type": "function",
"internal": false,
"description": "Creates a single marker wall entity.",
"directives": [
{
"directive": "param",
"text": "player_name\tstring\tThe name of the player it should belong to.",
"name": "player_name",
"type": "string",
"description": "The name of the player it should belong to."
},
{
"directive": "param",
"text": "pos1\t\tVector3\tThe pos1 corner of the area the SINGLE marker should cover.",
"name": "pos1",
"type": "Vector3",
"description": "The pos1 corner of the area the SINGLE marker should cover."
},
{
"directive": "param",
"text": "pos2\t\tVector3\tThe pos2 corner of the area the SINGLE marker should cover.",
"name": "pos2",
"type": "Vector3",
"description": "The pos2 corner of the area the SINGLE marker should cover."
},
{
"directive": "param",
"text": "side\t\tstring\tThe side that this wall is on. Valid values: x, -x, y, -y, z, -z.",
"name": "side",
"type": "string",
"description": "The side that this wall is on. Valid values: x, -x, y, -y, z, -z."
},
{
"directive": "returns",
"text": "Entity<WEAPositionMarkerWall>",
"type": "Entity<WEAPositionMarkerWall>"
}
],
"line": 157,
"namespace": "worldeditadditions_core.entities.pos_marker_wall",
"line_last": 163,
"name": "create_single",
"instanced": false,
"args": [
"player_name",
"pos1",
"pos2",
"side"
],
"text": "--- Creates a single marker wall entity.\n-- @param\tplayer_name\tstring\tThe name of the player it should belong to.\n-- @param\tpos1\t\tVector3\tThe pos1 corner of the area the SINGLE marker should cover.\n-- @param\tpos2\t\tVector3\tThe pos2 corner of the area the SINGLE marker should cover.\n-- @param\tside\t\tstring\tThe side that this wall is on. Valid values: x, -x, y, -y, z, -z.\n-- @returns\tEntity<WEAPositionMarkerWall>\nlocal function create_single(player_name, pos1, pos2, side)",
"params": [
{
"directive": "param",
"text": "player_name\tstring\tThe name of the player it should belong to.",
"name": "player_name",
"type": "string",
"description": "The name of the player it should belong to."
},
{
"directive": "param",
"text": "pos1\t\tVector3\tThe pos1 corner of the area the SINGLE marker should cover.",
"name": "pos1",
"type": "Vector3",
"description": "The pos1 corner of the area the SINGLE marker should cover."
},
{
"directive": "param",
"text": "pos2\t\tVector3\tThe pos2 corner of the area the SINGLE marker should cover.",
"name": "pos2",
"type": "Vector3",
"description": "The pos2 corner of the area the SINGLE marker should cover."
},
{
"directive": "param",
"text": "side\t\tstring\tThe side that this wall is on. Valid values: x, -x, y, -y, z, -z.",
"name": "side",
"type": "string",
"description": "The side that this wall is on. Valid values: x, -x, y, -y, z, -z."
}
],
"returns": {
"directive": "returns",
"text": "Entity<WEAPositionMarkerWall>",
"type": "Entity<WEAPositionMarkerWall>"
},
"examples": [],
"name_full": "worldeditadditions_core.entities.pos_marker_wall.create_single",
"filename": "worldeditadditions_core/core/entities/pos_marker_wall.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/entities/pos_marker_wall.lua#L158-L164"
}
create_wall 🔗
Creates a marker wall around the defined region.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player that the wall belongs to. |
pos1 | Vector3 | nil | pos1 of the defined region. |
pos2 | Vector3 | nil | pos2 of the defined region. |
sides_to_display | string | nil | The sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to "+x-x+z-z". Use "+x-x+z-z+y-y" to display all sides; add and remove sides as desired. |
Returns
table<entitylist>
:
A list of all created entities.
Source
--- Creates a marker wall around the defined region.
-- @param player_name string The name of the player that the wall belongs to.
-- @param pos1 Vector3 pos1 of the defined region.
-- @param pos2 Vector3 pos2 of the defined region.
-- @param sides_to_display string The sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to "+x-x+z-z". Use "+x-x+z-z+y-y" to display all sides; add and remove sides as desired.
-- @returns table<entitylist> A list of all created entities.
local function create_wall(player_name, pos1, pos2, sides_to_display)
{
"type": "function",
"internal": false,
"description": "Creates a marker wall around the defined region.",
"directives": [
{
"directive": "param",
"text": "player_name\t\t\tstring\tThe name of the player that the wall belongs to.",
"name": "player_name",
"type": "string",
"description": "The name of the player that the wall belongs to."
},
{
"directive": "param",
"text": "pos1\t\t\t\tVector3\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\t\t\t\tVector3\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
},
{
"directive": "param",
"text": "sides_to_display\tstring\tThe sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to \"+x-x+z-z\". Use \"+x-x+z-z+y-y\" to display all sides; add and remove sides as desired.",
"name": "sides_to_display",
"type": "string",
"description": "The sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to \"+x-x+z-z\". Use \"+x-x+z-z+y-y\" to display all sides; add and remove sides as desired."
},
{
"directive": "returns",
"text": "table<entitylist>\tA list of all created entities.",
"type": "table<entitylist>",
"description": "A list of all created entities."
}
],
"line": 183,
"namespace": "worldeditadditions_core.entities.pos_marker_wall",
"line_last": 189,
"name": "create_wall",
"instanced": false,
"args": [
"player_name",
"pos1",
"pos2",
"sides_to_display"
],
"text": "--- Creates a marker wall around the defined region.\n-- @param\tplayer_name\t\t\tstring\tThe name of the player that the wall belongs to.\n-- @param\tpos1\t\t\t\tVector3\tpos1 of the defined region.\n-- @param\tpos2\t\t\t\tVector3\tpos2 of the defined region.\n-- @param\tsides_to_display\tstring\tThe sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to \"+x-x+z-z\". Use \"+x-x+z-z+y-y\" to display all sides; add and remove sides as desired.\n-- @returns\ttable<entitylist>\tA list of all created entities.\nlocal function create_wall(player_name, pos1, pos2, sides_to_display)",
"params": [
{
"directive": "param",
"text": "player_name\t\t\tstring\tThe name of the player that the wall belongs to.",
"name": "player_name",
"type": "string",
"description": "The name of the player that the wall belongs to."
},
{
"directive": "param",
"text": "pos1\t\t\t\tVector3\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\t\t\t\tVector3\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
},
{
"directive": "param",
"text": "sides_to_display\tstring\tThe sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to \"+x-x+z-z\". Use \"+x-x+z-z+y-y\" to display all sides; add and remove sides as desired.",
"name": "sides_to_display",
"type": "string",
"description": "The sides of the marker wall that should actually be displayed, squished together into a single string. Defaults to \"+x-x+z-z\". Use \"+x-x+z-z+y-y\" to display all sides; add and remove sides as desired."
}
],
"returns": {
"directive": "returns",
"text": "table<entitylist>\tA list of all created entities.",
"type": "table<entitylist>",
"description": "A list of all created entities."
},
"examples": [],
"name_full": "worldeditadditions_core.entities.pos_marker_wall.create_wall",
"filename": "worldeditadditions_core/core/entities/pos_marker_wall.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/entities/pos_marker_wall.lua#L184-L190"
}
delete 🔗
Deletes all entities in the given entity list
Arguments
Name | Type | Default value | Description |
---|---|---|---|
entitylist | table<entity> | nil | A list of wall entities that make up the wall to delete. |
Returns
nil
Source
--- Deletes all entities in the given entity list
-- @param entitylist table<entity> A list of wall entities that make up the wall to delete.
local function delete(entitylist)
{
"type": "function",
"internal": false,
"description": "Deletes all entities in the given entity list",
"directives": [
{
"directive": "param",
"text": "entitylist\ttable<entity>\tA list of wall entities that make up the wall to delete.",
"name": "entitylist",
"type": "table<entity>",
"description": "A list of wall entities that make up the wall to delete."
}
],
"line": 486,
"namespace": "worldeditadditions_core.entities.pos_marker_wall",
"line_last": 488,
"name": "delete",
"instanced": false,
"args": [
"entitylist"
],
"text": "--- Deletes all entities in the given entity list\n-- @param\tentitylist\ttable<entity>\tA list of wall entities that make up the wall to delete.\nlocal function delete(entitylist)",
"params": [
{
"directive": "param",
"text": "entitylist\ttable<entity>\tA list of wall entities that make up the wall to delete.",
"name": "entitylist",
"type": "table<entity>",
"description": "A list of wall entities that make up the wall to delete."
}
],
"examples": [],
"name_full": "worldeditadditions_core.entities.pos_marker_wall.delete",
"filename": "worldeditadditions_core/core/entities/pos_marker_wall.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/entities/pos_marker_wall.lua#L487-L489"
}
get_last_reset 🔗
Gets the last_reset value for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the last_reset value for. |
update | bool | false | If true, then update the last_reset value for the given player to a new value. |
Returns
nil
Source
--- Gets the last_reset value for the given player.
-- @internal
-- @param player_name string The name of the player to fetch the last_reset value for.
-- @param update=false bool If true, then update the last_reset value for the given player to a new value.
local function get_last_reset(player_name, update)
{
"type": "function",
"internal": true,
"description": "Gets the last_reset value for the given player.",
"directives": [
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the last_reset value for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the last_reset value for."
},
{
"directive": "param",
"text": "update=false\tbool\tIf true, then update the last_reset value for the given player to a new value.",
"name": "update",
"type": "bool",
"description": "If true, then update the last_reset value for the given player to a new value.",
"default_value": "false"
}
],
"line": 17,
"namespace": "worldeditadditions_core.entities.pos_marker_wall",
"line_last": 21,
"name": "get_last_reset",
"instanced": false,
"args": [
"player_name",
"update"
],
"text": "--- Gets the last_reset value for the given player.\n-- @internal\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the last_reset value for.\n-- @param\tupdate=false\tbool\tIf true, then update the last_reset value for the given player to a new value.\nlocal function get_last_reset(player_name, update)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the last_reset value for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the last_reset value for."
},
{
"directive": "param",
"text": "update=false\tbool\tIf true, then update the last_reset value for the given player to a new value.",
"name": "update",
"type": "bool",
"description": "If true, then update the last_reset value for the given player to a new value.",
"default_value": "false"
}
],
"examples": [],
"name_full": "worldeditadditions_core.entities.pos_marker_wall.get_last_reset",
"filename": "worldeditadditions_core/core/entities/pos_marker_wall.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/entities/pos_marker_wall.lua#L18-L22"
}
EventEmitter 🔗
Event manager object.
Functions
addEventListener 🔗
Add a new listener to the given named event.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
this | EventEmitter | nil | The EventEmitter instance to add the listener to. |
event_name | string | nil | The name of the event to listen on. |
func | function | nil | The callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit(). |
Returns
number
:
The number of listeners attached to that event.
Source
--- Add a new listener to the given named event.
-- @param this EventEmitter The EventEmitter instance to add the listener to.
-- @param event_name string The name of the event to listen on.
-- @param func function The callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit().
-- @returns number The number of listeners attached to that event.
function EventEmitter.addEventListener(this, event_name, func)
{
"type": "function",
"internal": false,
"description": "Add a new listener to the given named event.",
"directives": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to add the listener to.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to add the listener to."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to listen on.",
"name": "event_name",
"type": "string",
"description": "The name of the event to listen on."
},
{
"directive": "param",
"text": "func\t\tfunction\t\tThe callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit().",
"name": "func",
"type": "function",
"description": "The callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit()."
},
{
"directive": "returns",
"text": "number\t\tThe number of listeners attached to that event.",
"type": "number",
"description": "The number of listeners attached to that event."
}
],
"line": 18,
"namespace": "worldeditadditions_core.EventEmitter",
"line_last": 23,
"name": "addEventListener",
"instanced": false,
"args": [
"this",
"event_name",
"func"
],
"text": "--- Add a new listener to the given named event.\n-- @param\tthis\t\tEventEmitter\tThe EventEmitter instance to add the listener to.\n-- @param\tevent_name\tstring\t\t\tThe name of the event to listen on.\n-- @param\tfunc\t\tfunction\t\tThe callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit().\n-- @returns\tnumber\t\tThe number of listeners attached to that event.\nfunction EventEmitter.addEventListener(this, event_name, func)",
"params": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to add the listener to.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to add the listener to."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to listen on.",
"name": "event_name",
"type": "string",
"description": "The name of the event to listen on."
},
{
"directive": "param",
"text": "func\t\tfunction\t\tThe callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit().",
"name": "func",
"type": "function",
"description": "The callback function to call when the event is emitted. Will be passed a single argument - the object passed as the second argument to .emit()."
}
],
"returns": {
"directive": "returns",
"text": "number\t\tThe number of listeners attached to that event.",
"type": "number",
"description": "The number of listeners attached to that event."
},
"examples": [],
"name_full": "worldeditadditions_core.EventEmitter.addEventListener",
"filename": "worldeditadditions_core/utils/EventEmitter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/EventEmitter.lua#L19-L24"
}
clear 🔗
Clear all listeners from a given event name.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
this | EventEmitter | nil | The EventEmitter instance to clear listeners from. |
event_name | string | nil | The name of the event to clear the listeners from. |
Returns
nil
Source
--- Clear all listeners from a given event name.
-- @param this EventEmitter The EventEmitter instance to clear listeners from.
-- @param event_name string The name of the event to clear the listeners from.
function EventEmitter.clear(this, event_name)
{
"type": "function",
"internal": false,
"description": "Clear all listeners from a given event name.",
"directives": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to clear listeners from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to clear listeners from."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to clear the listeners from.",
"name": "event_name",
"type": "string",
"description": "The name of the event to clear the listeners from."
}
],
"line": 73,
"namespace": "worldeditadditions_core.EventEmitter",
"line_last": 76,
"name": "clear",
"instanced": false,
"args": [
"this",
"event_name"
],
"text": "--- Clear all listeners from a given event name.\n-- @param\tthis\t\tEventEmitter\tThe EventEmitter instance to clear listeners from.\n-- @param\tevent_name\tstring\t\t\tThe name of the event to clear the listeners from.\nfunction EventEmitter.clear(this, event_name)",
"params": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to clear listeners from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to clear listeners from."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to clear the listeners from.",
"name": "event_name",
"type": "string",
"description": "The name of the event to clear the listeners from."
}
],
"examples": [],
"name_full": "worldeditadditions_core.EventEmitter.clear",
"filename": "worldeditadditions_core/utils/EventEmitter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/EventEmitter.lua#L74-L77"
}
clear_all 🔗
Clear all listeners.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
this | EventEmitter | nil | The EventEmitter instance to clear listeners from. |
Returns
nil
Source
--- Clear all listeners.
-- @param this EventEmitter The EventEmitter instance to clear listeners from.
function EventEmitter.clear_all(this, event_name)
{
"type": "function",
"internal": false,
"description": "Clear all listeners.",
"directives": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to clear listeners from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to clear listeners from."
}
],
"line": 80,
"namespace": "worldeditadditions_core.EventEmitter",
"line_last": 82,
"name": "clear_all",
"instanced": false,
"args": [
"this",
"event_name"
],
"text": "--- Clear all listeners.\n-- @param\tthis\t\tEventEmitter\tThe EventEmitter instance to clear listeners from.\nfunction EventEmitter.clear_all(this, event_name)",
"params": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to clear listeners from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to clear listeners from."
}
],
"examples": [],
"name_full": "worldeditadditions_core.EventEmitter.clear_all",
"filename": "worldeditadditions_core/utils/EventEmitter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/EventEmitter.lua#L81-L83"
}
emit 🔗
Emit an event.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
this | EventEmitter | nil | The EventEmitter instance to emit the event from. |
event_name | string | nil | The name of the event to emit. |
args | table|any | nil | The argument(s) to pass to listener functions. It is strongly advised you pass a table here. |
Returns
nil
Source
--- Emit an event.
-- @param this EventEmitter The EventEmitter instance to emit the event from.
-- @param event_name string The name of the event to emit.
-- @param args table|any The argument(s) to pass to listener functions. It is strongly advised you pass a table here.
function EventEmitter.emit(this, event_name, args)
{
"type": "function",
"internal": false,
"description": "Emit an event.",
"directives": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to emit the event from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to emit the event from."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to emit.",
"name": "event_name",
"type": "string",
"description": "The name of the event to emit."
},
{
"directive": "param",
"text": "args\t\ttable|any\t\tThe argument(s) to pass to listener functions. It is strongly advised you pass a table here.",
"name": "args",
"type": "table|any",
"description": "The argument(s) to pass to listener functions. It is strongly advised you pass a table here."
}
],
"line": 55,
"namespace": "worldeditadditions_core.EventEmitter",
"line_last": 59,
"name": "emit",
"instanced": false,
"args": [
"this",
"event_name",
"args"
],
"text": "--- Emit an event.\n-- @param\tthis\t\tEventEmitter\tThe EventEmitter instance to emit the event from.\n-- @param\tevent_name\tstring\t\t\tThe name of the event to emit.\n-- @param\targs\t\ttable|any\t\tThe argument(s) to pass to listener functions. It is strongly advised you pass a table here.\nfunction EventEmitter.emit(this, event_name, args)",
"params": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to emit the event from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to emit the event from."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to emit.",
"name": "event_name",
"type": "string",
"description": "The name of the event to emit."
},
{
"directive": "param",
"text": "args\t\ttable|any\t\tThe argument(s) to pass to listener functions. It is strongly advised you pass a table here.",
"name": "args",
"type": "table|any",
"description": "The argument(s) to pass to listener functions. It is strongly advised you pass a table here."
}
],
"examples": [],
"name_full": "worldeditadditions_core.EventEmitter.emit",
"filename": "worldeditadditions_core/utils/EventEmitter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/EventEmitter.lua#L56-L60"
}
new 🔗
Create a new event emitter.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table|nil | nil | Optional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN! |
Returns
table
:
The new EventEmitter object. If a table is passed in, a new table is NOT created.
Source
--- Create a new event emitter.
-- @param tbl table|nil Optional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN!
-- @returns table The new EventEmitter object. If a table is passed in, a new table is NOT created.
function EventEmitter.new(tbl)
{
"type": "function",
"internal": false,
"description": "Create a new event emitter.",
"directives": [
{
"directive": "param",
"text": "tbl\ttable|nil\tOptional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN!",
"name": "tbl",
"type": "table|nil",
"description": "Optional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN!"
},
{
"directive": "returns",
"text": "table\tThe new EventEmitter object. If a table is passed in, a new table is NOT created.",
"type": "table",
"description": "The new EventEmitter object. If a table is passed in, a new table is NOT created."
}
],
"line": 7,
"namespace": "worldeditadditions_core.EventEmitter",
"line_last": 10,
"name": "new",
"instanced": false,
"args": [
"tbl"
],
"text": "--- Create a new event emitter.\n-- @param\ttbl\ttable|nil\tOptional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN!\n-- @returns\ttable\tThe new EventEmitter object. If a table is passed in, a new table is NOT created.\nfunction EventEmitter.new(tbl)",
"params": [
{
"directive": "param",
"text": "tbl\ttable|nil\tOptional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN!",
"name": "tbl",
"type": "table|nil",
"description": "Optional. A table to base the new EventEmitter object on. EventEmitter will attach ann instance of itself to this object. The 'events' property on the object MUST NOT be set. IT WILL BE OVERWRITTEN!"
}
],
"returns": {
"directive": "returns",
"text": "table\tThe new EventEmitter object. If a table is passed in, a new table is NOT created.",
"type": "table",
"description": "The new EventEmitter object. If a table is passed in, a new table is NOT created."
},
"examples": [],
"name_full": "worldeditadditions_core.EventEmitter.new",
"filename": "worldeditadditions_core/utils/EventEmitter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/EventEmitter.lua#L8-L11"
}
removeEventListener 🔗
Remove an existing listener from the given named event.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
this | EventEmitter | nil | The EventEmitter instance to remove the listener from. |
event_name | string | nil | The name of the event to remove from. |
func | function | nil | The callback function to remove from the list of listeners for the given named event. |
Returns
bool
:
Whether it was actually removed or not. False means it failed to find the given listener function.
Source
--- Remove an existing listener from the given named event.
-- @param this EventEmitter The EventEmitter instance to remove the listener from.
-- @param event_name string The name of the event to remove from.
-- @param func function The callback function to remove from the list of listeners for the given named event.
-- @return bool Whether it was actually removed or not. False means it failed to find the given listener function.
function EventEmitter.removeEventListener(this, event_name, func)
{
"type": "function",
"internal": false,
"description": "Remove an existing listener from the given named event.",
"directives": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to remove the listener from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to remove the listener from."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to remove from.",
"name": "event_name",
"type": "string",
"description": "The name of the event to remove from."
},
{
"directive": "param",
"text": "func\t\tfunction\t\tThe callback function to remove from the list of listeners for the given named event.",
"name": "func",
"type": "function",
"description": "The callback function to remove from the list of listeners for the given named event."
},
{
"directive": "returns",
"text": "bool\t\tWhether it was actually removed or not. False means it failed to find the given listener function.",
"type": "bool",
"description": "Whether it was actually removed or not. False means it failed to find the given listener function."
}
],
"line": 36,
"namespace": "worldeditadditions_core.EventEmitter",
"line_last": 41,
"name": "removeEventListener",
"instanced": false,
"args": [
"this",
"event_name",
"func"
],
"text": "--- Remove an existing listener from the given named event.\n-- @param\tthis\t\tEventEmitter\tThe EventEmitter instance to remove the listener from.\n-- @param\tevent_name\tstring\t\t\tThe name of the event to remove from.\n-- @param\tfunc\t\tfunction\t\tThe callback function to remove from the list of listeners for the given named event.\n-- @return\tbool\t\tWhether it was actually removed or not. False means it failed to find the given listener function.\nfunction EventEmitter.removeEventListener(this, event_name, func)",
"params": [
{
"directive": "param",
"text": "this\t\tEventEmitter\tThe EventEmitter instance to remove the listener from.",
"name": "this",
"type": "EventEmitter",
"description": "The EventEmitter instance to remove the listener from."
},
{
"directive": "param",
"text": "event_name\tstring\t\t\tThe name of the event to remove from.",
"name": "event_name",
"type": "string",
"description": "The name of the event to remove from."
},
{
"directive": "param",
"text": "func\t\tfunction\t\tThe callback function to remove from the list of listeners for the given named event.",
"name": "func",
"type": "function",
"description": "The callback function to remove from the list of listeners for the given named event."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\tWhether it was actually removed or not. False means it failed to find the given listener function.",
"type": "bool",
"description": "Whether it was actually removed or not. False means it failed to find the given listener function."
},
"examples": [],
"name_full": "worldeditadditions_core.EventEmitter.removeEventListener",
"filename": "worldeditadditions_core/utils/EventEmitter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/EventEmitter.lua#L37-L42"
}
Face 🔗
A single face of a Mesh.
Functions
equal 🔗
Determines whether this face is equal to another face or not.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Face | nil | The first face to compare. |
b | Face | nil | The second face to compare. |
Returns
bool
:
Whether the 2 faces are equal or not.
Source
--- Determines whether this face is equal to another face or not.
-- @param a Face The first face to compare.
-- @param b Face The second face to compare.
-- @returns bool Whether the 2 faces are equal or not.
function Face.equal(a, b)
{
"type": "function",
"internal": false,
"description": "Determines whether this face is equal to another face or not.",
"directives": [
{
"directive": "param",
"text": "a\tFace\tThe first face to compare.",
"name": "a",
"type": "Face",
"description": "The first face to compare."
},
{
"directive": "param",
"text": "b\tFace\tThe second face to compare.",
"name": "b",
"type": "Face",
"description": "The second face to compare."
},
{
"directive": "returns",
"text": "bool\t\tWhether the 2 faces are equal or not.",
"type": "bool",
"description": "Whether the 2 faces are equal or not."
}
],
"line": 23,
"namespace": "worldeditadditions_core.Face",
"line_last": 27,
"name": "equal",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Determines whether this face is equal to another face or not.\n-- @param\ta\tFace\tThe first face to compare.\n-- @param\tb\tFace\tThe second face to compare.\n-- @returns\tbool\t\tWhether the 2 faces are equal or not.\nfunction Face.equal(a, b)",
"params": [
{
"directive": "param",
"text": "a\tFace\tThe first face to compare.",
"name": "a",
"type": "Face",
"description": "The first face to compare."
},
{
"directive": "param",
"text": "b\tFace\tThe second face to compare.",
"name": "b",
"type": "Face",
"description": "The second face to compare."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\tWhether the 2 faces are equal or not.",
"type": "bool",
"description": "Whether the 2 faces are equal or not."
},
"examples": [],
"name_full": "worldeditadditions_core.Face.equal",
"filename": "worldeditadditions_core/utils/mesh.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/mesh.lua#L24-L28"
}
new 🔗
Creates a new face from a list of vertices. The list of vertices should be anti-clockwise.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
vertices | Vector3[] | nil | A list of Vector3 vertices that define the face. |
Returns
nil
Source
--- Creates a new face from a list of vertices.
-- The list of vertices should be anti-clockwise.
-- @param vertices Vector3[] A list of Vector3 vertices that define the face.
function Face.new(vertices)
{
"type": "function",
"internal": false,
"description": "Creates a new face from a list of vertices.\nThe list of vertices should be anti-clockwise.",
"directives": [
{
"directive": "param",
"text": "vertices\tVector3[]\tA list of Vector3 vertices that define the face.",
"name": "vertices",
"type": "Vector3[]",
"description": "A list of Vector3 vertices that define the face."
}
],
"line": 14,
"namespace": "worldeditadditions_core.Face",
"line_last": 17,
"name": "new",
"instanced": false,
"args": [
"vertices"
],
"text": "--- Creates a new face from a list of vertices.\n-- The list of vertices should be anti-clockwise.\n-- @param\tvertices\tVector3[]\tA list of Vector3 vertices that define the face.\nfunction Face.new(vertices)",
"params": [
{
"directive": "param",
"text": "vertices\tVector3[]\tA list of Vector3 vertices that define the face.",
"name": "vertices",
"type": "Vector3[]",
"description": "A list of Vector3 vertices that define the face."
}
],
"examples": [],
"name_full": "worldeditadditions_core.Face.new",
"filename": "worldeditadditions_core/utils/mesh.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/mesh.lua#L15-L18"
}
io 🔗
Functions to abstract file I/O away. I'm very suspicious of Minetest's API changing from under our feet.
FileFormats 🔗
File formats WorldEditAdditions supports reading and/or writing. It is currently unclear which of these formats we will actually implement.
Current Status:
Format | Read | Write |
---|---|---|
weaschem | ||
mtschem | ||
we |
StagedVoxelRegion 🔗
A region of the world that is to be or has been saved to/from disk. This class exists to make moving things to/from disk easier and less complicated.
In short, use StagedVoxelRegion.NewFromVoxelManip or StagedVoxelRegion.NewFromTable to SAVE data, and StagedVoxelRegion.Load or StagedVoxelRegion.LoadIntoVoxelManip to LOAD data.
Functions
load 🔗
Loads a file of the an array.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
filepath | string | nil | The filepath to load the .weaschem file from. |
format | string | "auto" | The format in which the target is written in. |
Returns
nil
Source
--- Loads a file of the an array.
-- @param filepath string The filepath to load the .weaschem file from.
-- @param format="auto" string The format in which the target is written in.
function StagedVoxelRegion.load(filepath, format)
{
"type": "function",
"internal": false,
"description": "Loads a file of the an array.",
"directives": [
{
"directive": "param",
"text": "filepath\t\tstring\tThe filepath to load the .weaschem file from.",
"name": "filepath",
"type": "string",
"description": "The filepath to load the .weaschem file from."
},
{
"directive": "param",
"text": "format=\"auto\"\tstring\tThe format in which the target is written in.",
"name": "format",
"type": "string",
"description": "The format in which the target is written in.",
"default_value": "\"auto\""
}
],
"line": 197,
"namespace": "worldeditadditions_core.io.StagedVoxelRegion",
"line_last": 200,
"name": "load",
"instanced": false,
"args": [
"filepath",
"format"
],
"text": "--- Loads a file of the an array.\n-- @param\tfilepath\t\tstring\tThe filepath to load the .weaschem file from.\n-- @param\tformat=\"auto\"\tstring\tThe format in which the target is written in.\nfunction StagedVoxelRegion.load(filepath, format)",
"params": [
{
"directive": "param",
"text": "filepath\t\tstring\tThe filepath to load the .weaschem file from.",
"name": "filepath",
"type": "string",
"description": "The filepath to load the .weaschem file from."
},
{
"directive": "param",
"text": "format=\"auto\"\tstring\tThe format in which the target is written in.",
"name": "format",
"type": "string",
"description": "The format in which the target is written in.",
"default_value": "\"auto\""
}
],
"examples": [],
"name_full": "worldeditadditions_core.io.StagedVoxelRegion.load",
"filename": "worldeditadditions_core/utils/io/StagedVoxelRegion.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/io/StagedVoxelRegion.lua#L198-L201"
}
LoadRaw 🔗
Loads voxel data from disk, returning the raw UNPADDED arrays. In other words, the tables returned by this function WILL NOT fit directly into a VoxelManipulator, because VoxelManipulator data/param2 tables also contain padding data (likely because VoxelManip load only chunks at a time).
Note: This function does NOT modify the world.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
filepath | string | nil | The filepath to load data from. |
pos1 | Vector3 | nil | Position 1 in WORLD space to load the data into. |
pos2 | Vector3 | nil | Position 2 in WORLD space to load the data into. |
format | string | "auto" | The format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information. |
Returns
bool,table
:
A success/failure bool, followed by TODO: The format of this table is still to be decided.
Source
--- Loads voxel data from disk, returning the raw UNPADDED arrays.
-- In other words, the tables returned by this function WILL NOT fit directly into a VoxelManipulator, because VoxelManipulator data/param2 tables also contain padding data (likely because VoxelManip load only chunks at a time).
--
-- **Note:** This function does NOT modify the world.
-- @static
-- @param filepath string The filepath to load data from.
-- @param pos1 Vector3 Position 1 in WORLD space to load the data into.
-- @param pos2 Vector3 Position 2 in WORLD space to load the data into.
-- @param format="auto" string The format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.
-- @returns bool,table A success/failure bool, followed by TODO: The format of this table is still to be decided.
function StagedVoxelRegion.LoadRaw(filepath, pos1, pos2, format)
{
"type": "function",
"internal": false,
"description": "Loads voxel data from disk, returning the raw UNPADDED arrays.\nIn other words, the tables returned by this function WILL NOT fit directly into a VoxelManipulator, because VoxelManipulator data/param2 tables also contain padding data (likely because VoxelManip load only chunks at a time).\n\n**Note:** This function does NOT modify the world.",
"directives": [
{
"directive": "static",
"text": ""
},
{
"directive": "param",
"text": "filepath\t\tstring\tThe filepath to load data from.",
"name": "filepath",
"type": "string",
"description": "The filepath to load data from."
},
{
"directive": "param",
"text": "pos1\t\t\tVector3\tPosition 1 in WORLD space to load the data into.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 in WORLD space to load the data into."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\tPosition 2 in WORLD space to load the data into.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 in WORLD space to load the data into."
},
{
"directive": "param",
"text": "format=\"auto\"\tstring\tThe format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"name": "format",
"type": "string",
"description": "The format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"default_value": "\"auto\""
},
{
"directive": "returns",
"text": "bool,table\t\tA success/failure bool, followed by TODO: The format of this table is still to be decided.",
"type": "bool,table",
"description": "A success/failure bool, followed by TODO: The format of this table is still to be decided."
}
],
"line": 113,
"namespace": "worldeditadditions_core.io.StagedVoxelRegion",
"line_last": 123,
"name": "LoadRaw",
"instanced": false,
"args": [
"filepath",
"pos1",
"pos2",
"format"
],
"text": "--- Loads voxel data from disk, returning the raw UNPADDED arrays.\n-- In other words, the tables returned by this function WILL NOT fit directly into a VoxelManipulator, because VoxelManipulator data/param2 tables also contain padding data (likely because VoxelManip load only chunks at a time).\n-- \n-- **Note:** This function does NOT modify the world.\n-- @static\n-- @param\tfilepath\t\tstring\tThe filepath to load data from.\n-- @param\tpos1\t\t\tVector3\tPosition 1 in WORLD space to load the data into.\n-- @param\tpos2\t\t\tVector3\tPosition 2 in WORLD space to load the data into.\n-- @param\tformat=\"auto\"\tstring\tThe format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.\n-- @returns\tbool,table\t\tA success/failure bool, followed by TODO: The format of this table is still to be decided.\nfunction StagedVoxelRegion.LoadRaw(filepath, pos1, pos2, format)",
"params": [
{
"directive": "param",
"text": "filepath\t\tstring\tThe filepath to load data from.",
"name": "filepath",
"type": "string",
"description": "The filepath to load data from."
},
{
"directive": "param",
"text": "pos1\t\t\tVector3\tPosition 1 in WORLD space to load the data into.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 in WORLD space to load the data into."
},
{
"directive": "param",
"text": "pos2\t\t\tVector3\tPosition 2 in WORLD space to load the data into.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 in WORLD space to load the data into."
},
{
"directive": "param",
"text": "format=\"auto\"\tstring\tThe format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"name": "format",
"type": "string",
"description": "The format that the source data is in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"default_value": "\"auto\""
}
],
"returns": {
"directive": "returns",
"text": "bool,table\t\tA success/failure bool, followed by TODO: The format of this table is still to be decided.",
"type": "bool,table",
"description": "A success/failure bool, followed by TODO: The format of this table is still to be decided."
},
"examples": [],
"name_full": "worldeditadditions_core.io.StagedVoxelRegion.LoadRaw",
"filename": "worldeditadditions_core/utils/io/StagedVoxelRegion.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/io/StagedVoxelRegion.lua#L114-L124"
}
NewFromRaw 🔗
Creates a new StagedVoxelRegion from raw data/param2 tables.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The position in WORLD SPACE of pos1 of the defined region to stage for saving. |
pos2 | Vector3 | nil | The position in WORLD SPACE of pos2 of the defined region to stage for saving. |
offset | Vector3 | nil | Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof. |
data | number[] | nil | A table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip! |
param2 | number[] | nil | A table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip! |
Returns
bool,StagedVoxelRegion
:
A success boolean, followed by the new StagedVoxelRegion instance.
Source
--- Creates a new StagedVoxelRegion from raw data/param2 tables.
-- @static
-- @param pos1 Vector3 The position in WORLD SPACE of pos1 of the defined region to stage for saving.
-- @param pos2 Vector3 The position in WORLD SPACE of pos2 of the defined region to stage for saving.
-- @param offset Vector3 Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.
-- @param data number[] A table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!
-- @param param2 number[] A table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!
-- @returns bool,StagedVoxelRegion A success boolean, followed by the new StagedVoxelRegion instance.
function StagedVoxelRegion.NewFromRaw(pos1, pos2, offset, data, param2)
{
"type": "function",
"internal": false,
"description": "Creates a new StagedVoxelRegion from raw data/param2 tables.",
"directives": [
{
"directive": "static",
"text": ""
},
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe position in WORLD SPACE of pos1 of the defined region to stage for saving.",
"name": "pos1",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos1 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tThe position in WORLD SPACE of pos2 of the defined region to stage for saving.",
"name": "pos2",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos2 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "offset\t\tVector3\t\tApply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.",
"name": "offset",
"type": "Vector3",
"description": "Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof."
},
{
"directive": "param",
"text": "data\tnumber[]\t\tA table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!",
"name": "data",
"type": "number[]",
"description": "A table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!"
},
{
"directive": "param",
"text": "param2\tnumber[]\t\tA table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!",
"name": "param2",
"type": "number[]",
"description": "A table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!"
},
{
"directive": "returns",
"text": "bool,StagedVoxelRegion\tA success boolean, followed by the new StagedVoxelRegion instance.",
"type": "bool,StagedVoxelRegion",
"description": "A success boolean, followed by the new StagedVoxelRegion instance."
}
],
"line": 60,
"namespace": "worldeditadditions_core.io.StagedVoxelRegion",
"line_last": 68,
"name": "NewFromRaw",
"instanced": false,
"args": [
"pos1",
"pos2",
"offset",
"data",
"param2"
],
"text": "--- Creates a new StagedVoxelRegion from raw data/param2 tables.\n-- @static\n-- @param\tpos1\t\tVector3\t\tThe position in WORLD SPACE of pos1 of the defined region to stage for saving.\n-- @param\tpos2\t\tVector3\t\tThe position in WORLD SPACE of pos2 of the defined region to stage for saving.\n-- @param\toffset\t\tVector3\t\tApply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.\n-- @param\tdata\tnumber[]\t\tA table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!\n-- @param\tparam2\tnumber[]\t\tA table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!\n-- @returns\tbool,StagedVoxelRegion\tA success boolean, followed by the new StagedVoxelRegion instance.\nfunction StagedVoxelRegion.NewFromRaw(pos1, pos2, offset, data, param2)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\tThe position in WORLD SPACE of pos1 of the defined region to stage for saving.",
"name": "pos1",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos1 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\tThe position in WORLD SPACE of pos2 of the defined region to stage for saving.",
"name": "pos2",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos2 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "offset\t\tVector3\t\tApply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.",
"name": "offset",
"type": "Vector3",
"description": "Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof."
},
{
"directive": "param",
"text": "data\tnumber[]\t\tA table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!",
"name": "data",
"type": "number[]",
"description": "A table of numbers representing the node ids. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!"
},
{
"directive": "param",
"text": "param2\tnumber[]\t\tA table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!",
"name": "param2",
"type": "number[]",
"description": "A table of numbers representing the param2 data. Should exactly match the data number[] in size. Must be ALREADY TRIMMED, NOT just taken straight from a VoxelManip!"
}
],
"returns": {
"directive": "returns",
"text": "bool,StagedVoxelRegion\tA success boolean, followed by the new StagedVoxelRegion instance.",
"type": "bool,StagedVoxelRegion",
"description": "A success boolean, followed by the new StagedVoxelRegion instance."
},
"examples": [],
"name_full": "worldeditadditions_core.io.StagedVoxelRegion.NewFromRaw",
"filename": "worldeditadditions_core/utils/io/StagedVoxelRegion.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/io/StagedVoxelRegion.lua#L61-L69"
}
NewFromVoxelManip 🔗
Creates a new StagedVoxelRegion from the data in a VoxelManipulator. To save data, you probably want to call the save() method.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The position in WORLD SPACE of pos1 of the defined region to stage for saving. |
pos2 | Vector3 | nil | The position in WORLD SPACE of pos2 of the defined region to stage for saving. |
offset | Vector3 | nil | Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof. |
voxelmanip | VoxelManipulator | nil | The voxel manipulator to take data from and save to disk. |
Returns
bool,StagedVoxelRegion
:
A success boolean, followed by the new StagedVoxelRegion instance.
Source
--- Creates a new StagedVoxelRegion from the data in a VoxelManipulator.
-- To save data, you probably want to call the save() method.
-- @param pos1 Vector3 The position in WORLD SPACE of pos1 of the defined region to stage for saving.
-- @param pos2 Vector3 The position in WORLD SPACE of pos2 of the defined region to stage for saving.
-- @param offset Vector3 Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.
-- @param voxelmanip VoxelManipulator The voxel manipulator to take data from and save to disk.
-- @returns bool,StagedVoxelRegion A success boolean, followed by the new StagedVoxelRegion instance.
function StagedVoxelRegion.NewFromVoxelManip(pos1, pos2, offset, voxelmanip)
{
"type": "function",
"internal": false,
"description": "Creates a new StagedVoxelRegion from the data in a VoxelManipulator.\nTo save data, you probably want to call the save() method.",
"directives": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\t\t\tThe position in WORLD SPACE of pos1 of the defined region to stage for saving.",
"name": "pos1",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos1 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\t\t\tThe position in WORLD SPACE of pos2 of the defined region to stage for saving.",
"name": "pos2",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos2 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "offset\t\tVector3\t\tApply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.",
"name": "offset",
"type": "Vector3",
"description": "Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof."
},
{
"directive": "param",
"text": "voxelmanip\tVoxelManipulator\tThe voxel manipulator to take data from and save to disk.",
"name": "voxelmanip",
"type": "VoxelManipulator",
"description": "The voxel manipulator to take data from and save to disk."
},
{
"directive": "returns",
"text": "bool,StagedVoxelRegion\tA success boolean, followed by the new StagedVoxelRegion instance.",
"type": "bool,StagedVoxelRegion",
"description": "A success boolean, followed by the new StagedVoxelRegion instance."
}
],
"line": 36,
"namespace": "worldeditadditions_core.io.StagedVoxelRegion",
"line_last": 43,
"name": "NewFromVoxelManip",
"instanced": false,
"args": [
"pos1",
"pos2",
"offset",
"voxelmanip"
],
"text": "--- Creates a new StagedVoxelRegion from the data in a VoxelManipulator.\n-- To save data, you probably want to call the save() method.\n-- @param\tpos1\t\tVector3\t\t\t\tThe position in WORLD SPACE of pos1 of the defined region to stage for saving.\n-- @param\tpos2\t\tVector3\t\t\t\tThe position in WORLD SPACE of pos2 of the defined region to stage for saving.\n-- @param\toffset\t\tVector3\t\tApply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.\n-- @param\tvoxelmanip\tVoxelManipulator\tThe voxel manipulator to take data from and save to disk.\n-- @returns\tbool,StagedVoxelRegion\tA success boolean, followed by the new StagedVoxelRegion instance.\nfunction StagedVoxelRegion.NewFromVoxelManip(pos1, pos2, offset, voxelmanip)",
"params": [
{
"directive": "param",
"text": "pos1\t\tVector3\t\t\t\tThe position in WORLD SPACE of pos1 of the defined region to stage for saving.",
"name": "pos1",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos1 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "pos2\t\tVector3\t\t\t\tThe position in WORLD SPACE of pos2 of the defined region to stage for saving.",
"name": "pos2",
"type": "Vector3",
"description": "The position in WORLD SPACE of pos2 of the defined region to stage for saving."
},
{
"directive": "param",
"text": "offset\t\tVector3\t\tApply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof.",
"name": "offset",
"type": "Vector3",
"description": "Apply this offset before placing in the world. e.g. if you have a schematic of a tree, and want it to place centred on the base thereof."
},
{
"directive": "param",
"text": "voxelmanip\tVoxelManipulator\tThe voxel manipulator to take data from and save to disk.",
"name": "voxelmanip",
"type": "VoxelManipulator",
"description": "The voxel manipulator to take data from and save to disk."
}
],
"returns": {
"directive": "returns",
"text": "bool,StagedVoxelRegion\tA success boolean, followed by the new StagedVoxelRegion instance.",
"type": "bool,StagedVoxelRegion",
"description": "A success boolean, followed by the new StagedVoxelRegion instance."
},
"examples": [],
"name_full": "worldeditadditions_core.io.StagedVoxelRegion.NewFromVoxelManip",
"filename": "worldeditadditions_core/utils/io/StagedVoxelRegion.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/io/StagedVoxelRegion.lua#L37-L44"
}
save 🔗
Saves the StagedVoxelRegion to the filepath.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
filepath | string | nil | The filepath to save the StagedVoxelRegion to. |
format | string | "auto" | The format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information. |
Returns
bool
:
Whether the operation was successful or not.
Source
--- Saves the StagedVoxelRegion to the filepath.
-- @param filepath string The filepath to save the StagedVoxelRegion to.
-- @param format="auto" string The format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.
-- @returns bool Whether the operation was successful or not.
function StagedVoxelRegion.save(svr, filepath, format)
{
"type": "function",
"internal": false,
"description": "Saves the StagedVoxelRegion to the filepath.",
"directives": [
{
"directive": "param",
"text": "filepath\t\tstring\tThe filepath to save the StagedVoxelRegion to.",
"name": "filepath",
"type": "string",
"description": "The filepath to save the StagedVoxelRegion to."
},
{
"directive": "param",
"text": "format=\"auto\"\tstring\tThe format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"name": "format",
"type": "string",
"description": "The format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"default_value": "\"auto\""
},
{
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not.",
"type": "bool",
"description": "Whether the operation was successful or not."
}
],
"line": 138,
"namespace": "worldeditadditions_core.io.StagedVoxelRegion",
"line_last": 142,
"name": "save",
"instanced": false,
"args": [
"svr",
"filepath",
"format"
],
"text": "--- Saves the StagedVoxelRegion to the filepath.\n-- @param\tfilepath\t\tstring\tThe filepath to save the StagedVoxelRegion to.\n-- @param\tformat=\"auto\"\tstring\tThe format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.\n-- @returns\tbool\t\t\tWhether the operation was successful or not.\nfunction StagedVoxelRegion.save(svr, filepath, format)",
"params": [
{
"directive": "param",
"text": "filepath\t\tstring\tThe filepath to save the StagedVoxelRegion to.",
"name": "filepath",
"type": "string",
"description": "The filepath to save the StagedVoxelRegion to."
},
{
"directive": "param",
"text": "format=\"auto\"\tstring\tThe format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"name": "format",
"type": "string",
"description": "The format to save in. Default: automatic, determine from file extension. See worldeditadditions_core.io.FileFormats for more information.",
"default_value": "\"auto\""
}
],
"returns": {
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not.",
"type": "bool",
"description": "Whether the operation was successful or not."
},
"examples": [],
"name_full": "worldeditadditions_core.io.StagedVoxelRegion.save",
"filename": "worldeditadditions_core/utils/io/StagedVoxelRegion.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/io/StagedVoxelRegion.lua#L139-L143"
}
LRU 🔗
A least-recently-used cache implementation.
Functions
get 🔗
Gets the value associated with the given key.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
key | string | nil | The key to retrieve the value for. |
Returns
any|nil
:
The value associated with the given key, or nil if it doesn't exist in this cache.
Source
--- Gets the value associated with the given key.
-- @param key string The key to retrieve the value for.
-- @returns any|nil The value associated with the given key, or nil if it doesn't exist in this cache.
function LRU:get(key)
{
"type": "function",
"internal": false,
"description": "Gets the value associated with the given key.",
"directives": [
{
"directive": "param",
"text": "key\t\tstring\tThe key to retrieve the value for.",
"name": "key",
"type": "string",
"description": "The key to retrieve the value for."
},
{
"directive": "returns",
"text": "any|nil\tThe value associated with the given key, or nil if it doesn't exist in this cache.",
"type": "any|nil",
"description": "The value associated with the given key, or nil if it doesn't exist in this cache."
}
],
"line": 36,
"namespace": "worldeditadditions_core.LRU",
"line_last": 39,
"name": "get",
"instanced": true,
"args": [
"key"
],
"text": "--- Gets the value associated with the given key.\n-- @param\tkey\t\tstring\tThe key to retrieve the value for.\n-- @returns\tany|nil\tThe value associated with the given key, or nil if it doesn't exist in this cache.\nfunction LRU:get(key)",
"params": [
{
"directive": "param",
"text": "key\t\tstring\tThe key to retrieve the value for.",
"name": "key",
"type": "string",
"description": "The key to retrieve the value for."
}
],
"returns": {
"directive": "returns",
"text": "any|nil\tThe value associated with the given key, or nil if it doesn't exist in this cache.",
"type": "any|nil",
"description": "The value associated with the given key, or nil if it doesn't exist in this cache."
},
"examples": [],
"name_full": "worldeditadditions_core.LRU.get",
"filename": "worldeditadditions_core/utils/lru.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/lru.lua#L37-L40"
}
has 🔗
Determines whether the given key is present in this cache object. Does NOT update the most recently used status of said key.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
key | string | nil | The key to check. |
Returns
bool
:
Whether the given key exists in the cache or not.
Source
--- Determines whether the given key is present in this cache object.
-- Does NOT update the most recently used status of said key.
-- @param key string The key to check.
-- @returns bool Whether the given key exists in the cache or not.
function LRU:has(key)
{
"type": "function",
"internal": false,
"description": "Determines whether the given key is present in this cache object.\nDoes NOT update the most recently used status of said key.",
"directives": [
{
"directive": "param",
"text": "key\t\tstring\tThe key to check.",
"name": "key",
"type": "string",
"description": "The key to check."
},
{
"directive": "returns",
"text": "bool\tWhether the given key exists in the cache or not.",
"type": "bool",
"description": "Whether the given key exists in the cache or not."
}
],
"line": 28,
"namespace": "worldeditadditions_core.LRU",
"line_last": 32,
"name": "has",
"instanced": true,
"args": [
"key"
],
"text": "--- Determines whether the given key is present in this cache object.\n-- Does NOT update the most recently used status of said key.\n-- @param\tkey\t\tstring\tThe key to check.\n-- @returns\tbool\tWhether the given key exists in the cache or not.\nfunction LRU:has(key)",
"params": [
{
"directive": "param",
"text": "key\t\tstring\tThe key to check.",
"name": "key",
"type": "string",
"description": "The key to check."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the given key exists in the cache or not.",
"type": "bool",
"description": "Whether the given key exists in the cache or not."
},
"examples": [],
"name_full": "worldeditadditions_core.LRU.has",
"filename": "worldeditadditions_core/utils/lru.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/lru.lua#L29-L33"
}
new 🔗
Creates a new LRU cache. Optimal sizes: 8, 16, 32, 64 or any value above
Arguments
Name | Type | Default value | Description |
---|---|---|---|
max_size | number | 32 | The maximum number of items to store in the cache. |
Returns
LRU
:
A new LRU cache.
Source
--- Creates a new LRU cache.
-- Optimal sizes: 8, 16, 32, 64 or any value above
-- @param max_size=32 number The maximum number of items to store in the cache.
-- @returns LRU A new LRU cache.
function LRU.new(max_size)
{
"type": "function",
"internal": false,
"description": "Creates a new LRU cache.\nOptimal sizes: 8, 16, 32, 64 or any value above",
"directives": [
{
"directive": "param",
"text": "max_size=32\t\tnumber\tThe maximum number of items to store in the cache.",
"name": "max_size",
"type": "number",
"description": "The maximum number of items to store in the cache.",
"default_value": "32"
},
{
"directive": "returns",
"text": "LRU\t\t\t\tA new LRU cache.",
"type": "LRU",
"description": "A new LRU cache."
}
],
"line": 12,
"namespace": "worldeditadditions_core.LRU",
"line_last": 16,
"name": "new",
"instanced": false,
"args": [
"max_size"
],
"text": "--- Creates a new LRU cache.\n-- Optimal sizes: 8, 16, 32, 64 or any value above\n-- @param\tmax_size=32\t\tnumber\tThe maximum number of items to store in the cache.\n-- @returns\tLRU\t\t\t\tA new LRU cache.\nfunction LRU.new(max_size)",
"params": [
{
"directive": "param",
"text": "max_size=32\t\tnumber\tThe maximum number of items to store in the cache.",
"name": "max_size",
"type": "number",
"description": "The maximum number of items to store in the cache.",
"default_value": "32"
}
],
"returns": {
"directive": "returns",
"text": "LRU\t\t\t\tA new LRU cache.",
"type": "LRU",
"description": "A new LRU cache."
},
"examples": [],
"name_full": "worldeditadditions_core.LRU.new",
"filename": "worldeditadditions_core/utils/lru.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/lru.lua#L13-L17"
}
set 🔗
Adds a given key-value pair to this cache. Note that this might (or might not) result in the eviction of another item.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
key | string | nil | The key of the item to add. |
value | any | nil | The value to associate with the given key. |
Returns
nil
Source
--- Adds a given key-value pair to this cache.
-- Note that this might (or might not) result in the eviction of another item.
-- @param key string The key of the item to add.
-- @param value any The value to associate with the given key.
-- @returns nil
function LRU:set(key, value)
{
"type": "function",
"internal": false,
"description": "Adds a given key-value pair to this cache.\nNote that this might (or might not) result in the eviction of another item.",
"directives": [
{
"directive": "param",
"text": "key\t\tstring\tThe key of the item to add.",
"name": "key",
"type": "string",
"description": "The key of the item to add."
},
{
"directive": "param",
"text": "value\tany\t\tThe value to associate with the given key.",
"name": "value",
"type": "any",
"description": "The value to associate with the given key."
},
{
"directive": "returns",
"text": "nil",
"type": "nil"
}
],
"line": 49,
"namespace": "worldeditadditions_core.LRU",
"line_last": 54,
"name": "set",
"instanced": true,
"args": [
"key",
"value"
],
"text": "--- Adds a given key-value pair to this cache.\n-- Note that this might (or might not) result in the eviction of another item.\n-- @param\tkey\t\tstring\tThe key of the item to add.\n-- @param\tvalue\tany\t\tThe value to associate with the given key.\n-- @returns nil\nfunction LRU:set(key, value)",
"params": [
{
"directive": "param",
"text": "key\t\tstring\tThe key of the item to add.",
"name": "key",
"type": "string",
"description": "The key of the item to add."
},
{
"directive": "param",
"text": "value\tany\t\tThe value to associate with the given key.",
"name": "value",
"type": "any",
"description": "The value to associate with the given key."
}
],
"returns": {
"directive": "returns",
"text": "nil",
"type": "nil"
},
"examples": [],
"name_full": "worldeditadditions_core.LRU.set",
"filename": "worldeditadditions_core/utils/lru.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/lru.lua#L50-L55"
}
Mesh 🔗
A mesh of faces.
Functions
add_face 🔗
Adds a face to this mesh.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
self | Mesh | nil | The mesh instance to operate on. |
face | Face | nil | The face to add. |
Returns
void
Source
--- Adds a face to this mesh.
-- @param self Mesh The mesh instance to operate on.
-- @param face Face The face to add.
-- @returns void
function Mesh.add_face(self, face)
{
"type": "function",
"internal": false,
"description": "Adds a face to this mesh.",
"directives": [
{
"directive": "param",
"text": "self\tMesh\tThe mesh instance to operate on.",
"name": "self",
"type": "Mesh",
"description": "The mesh instance to operate on."
},
{
"directive": "param",
"text": "face\tFace\tThe face to add.",
"name": "face",
"type": "Face",
"description": "The face to add."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 55,
"namespace": "worldeditadditions_core.Mesh",
"line_last": 59,
"name": "add_face",
"instanced": false,
"args": [
"self",
"face"
],
"text": "--- Adds a face to this mesh.\n-- @param\tself\tMesh\tThe mesh instance to operate on.\n-- @param\tface\tFace\tThe face to add.\n-- @returns\tvoid\nfunction Mesh.add_face(self, face)",
"params": [
{
"directive": "param",
"text": "self\tMesh\tThe mesh instance to operate on.",
"name": "self",
"type": "Mesh",
"description": "The mesh instance to operate on."
},
{
"directive": "param",
"text": "face\tFace\tThe face to add.",
"name": "face",
"type": "Face",
"description": "The face to add."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions_core.Mesh.add_face",
"filename": "worldeditadditions_core/utils/mesh.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/mesh.lua#L56-L60"
}
dedupe 🔗
Deduplicate the list of faces in this Mesh. Removes all faces that are exactly equal to one another. This reduces the filesize.
Arguments
This function takes no arguments.
Returns
number
:
The number of faces removed.
Source
--- Deduplicate the list of faces in this Mesh.
-- Removes all faces that are exactly equal to one another. This reduces the
-- filesize.
-- @returns number The number of faces removed.
function Mesh.dedupe(self)
{
"type": "function",
"internal": false,
"description": "Deduplicate the list of faces in this Mesh.\nRemoves all faces that are exactly equal to one another. This reduces the\nfilesize.",
"directives": [
{
"directive": "returns",
"text": "number\tThe number of faces removed.",
"type": "number",
"description": "The number of faces removed."
}
],
"line": 63,
"namespace": "worldeditadditions_core.Mesh",
"line_last": 67,
"name": "dedupe",
"instanced": false,
"args": [
"self"
],
"text": "--- Deduplicate the list of faces in this Mesh.\n-- Removes all faces that are exactly equal to one another. This reduces the\n-- filesize.\n-- @returns\tnumber\tThe number of faces removed.\nfunction Mesh.dedupe(self)",
"params": [],
"returns": {
"directive": "returns",
"text": "number\tThe number of faces removed.",
"type": "number",
"description": "The number of faces removed."
},
"examples": [],
"name_full": "worldeditadditions_core.Mesh.dedupe",
"filename": "worldeditadditions_core/utils/mesh.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/mesh.lua#L64-L68"
}
new 🔗
Creates a new empty mesh object container.
Arguments
This function takes no arguments.
Returns
Mesh
Source
--- Creates a new empty mesh object container.
-- @returns Mesh
function Mesh.new()
{
"type": "function",
"internal": false,
"description": "Creates a new empty mesh object container.",
"directives": [
{
"directive": "returns",
"text": "Mesh",
"type": "Mesh"
}
],
"line": 48,
"namespace": "worldeditadditions_core.Mesh",
"line_last": 50,
"name": "new",
"instanced": false,
"args": [
""
],
"text": "--- Creates a new empty mesh object container.\n-- @returns\tMesh\nfunction Mesh.new()",
"params": [],
"returns": {
"directive": "returns",
"text": "Mesh",
"type": "Mesh"
},
"examples": [],
"name_full": "worldeditadditions_core.Mesh.new",
"filename": "worldeditadditions_core/utils/mesh.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/mesh.lua#L49-L51"
}
NodeListMatcher 🔗
Matcherer that compares node ids to given list of node names. This is a class so that caching can be done locally and per-task.
Functions
__parse_nodelist 🔗
Parses a list of node names, accounting for special keywords and group names.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
nodelist | string[] | nil | The list of nodes to parse. |
Returns
bool,string|table<string|function|number>
:
A success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.
Different data types in the parsed nodelist mean different things:
- string: The name of a group
- function: A special function to call with the node id to match against as the first and only argument.
- number: The id of the node to check against.
Source
--- Parses a list of node names, accounting for special keywords and group names.
-- @param nodelist string[] The list of nodes to parse.
-- @returns bool,string|table<string|function|number> A success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.
--
-- Different data types in the parsed nodelist mean different things:
--
-- - **string:** The name of a group
-- - **function:** A special function to call with the node id to match against as the first and only argument.
-- - **number:** The id of the node to check against.
local function __parse_nodelist(nodelist)
{
"type": "function",
"internal": false,
"description": "Parses a list of node names, accounting for special keywords and group names.",
"directives": [
{
"directive": "param",
"text": "nodelist\tstring[]\tThe list of nodes to parse.",
"name": "nodelist",
"type": "string[]",
"description": "The list of nodes to parse."
},
{
"directive": "returns",
"text": "bool,string|table<string|function|number>\tA success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.\n\nDifferent data types in the parsed nodelist mean different things:\n\n- **string:** The name of a group\n- **function:** A special function to call with the node id to match against as the first and only argument.\n- **number:** The id of the node to check against.",
"type": "bool,string|table<string|function|number>",
"description": "A success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.\n\nDifferent data types in the parsed nodelist mean different things:\n\n- **string:** The name of a group\n- **function:** A special function to call with the node id to match against as the first and only argument.\n- **number:** The id of the node to check against."
}
],
"line": 19,
"namespace": "worldeditadditions_core.NodeListMatcher",
"line_last": 28,
"name": "__parse_nodelist",
"instanced": false,
"args": [
"nodelist"
],
"text": "--- Parses a list of node names, accounting for special keywords and group names.\n-- @param\tnodelist\tstring[]\tThe list of nodes to parse.\n-- @returns\tbool,string|table<string|function|number>\tA success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.\n-- \n-- Different data types in the parsed nodelist mean different things:\n-- \n-- - **string:** The name of a group\n-- - **function:** A special function to call with the node id to match against as the first and only argument.\n-- - **number:** The id of the node to check against.\nlocal function __parse_nodelist(nodelist)",
"params": [
{
"directive": "param",
"text": "nodelist\tstring[]\tThe list of nodes to parse.",
"name": "nodelist",
"type": "string[]",
"description": "The list of nodes to parse."
}
],
"returns": {
"directive": "returns",
"text": "bool,string|table<string|function|number>\tA success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.\n\nDifferent data types in the parsed nodelist mean different things:\n\n- **string:** The name of a group\n- **function:** A special function to call with the node id to match against as the first and only argument.\n- **number:** The id of the node to check against.",
"type": "bool,string|table<string|function|number>",
"description": "A success bool (true = success), followed by eitheran error string if success == false or the parsed nodelist if success == true.\n\nDifferent data types in the parsed nodelist mean different things:\n\n- **string:** The name of a group\n- **function:** A special function to call with the node id to match against as the first and only argument.\n- **number:** The id of the node to check against."
},
"examples": [],
"name_full": "worldeditadditions_core.NodeListMatcher.__parse_nodelist",
"filename": "worldeditadditions_core/utils/NodeListMatcher.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/NodeListMatcher.lua#L20-L29"
}
match_group 🔗
Determines if the given node id has the given group name. Caches the result for performance. You probably want NodeListMatcher:match_id(node_id).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
matcher | NodeListMatcher | nil | The NodeListMatcher instance to use to make the query. |
node_id | number | nil | The numerical id of the node to check. |
group_name | string | nil | The name of the group to check if the given node id has. |
Returns
bool
:
True if the given node id belongs to the specified group, and false if it does not.
Source
--- Determines if the given node id has the given group name.
-- Caches the result for performance. You probably want NodeListMatcher:match_id(node_id).
-- @param matcher NodeListMatcher The NodeListMatcher instance to use to make the query.
-- @param node_id number The numerical id of the node to check.
-- @param group_name string The name of the group to check if the given node id has.
-- @returns bool True if the given node id belongs to the specified group, and false if it does not.
function NodeListMatcher.match_group(matcher, node_id, group_name)
{
"type": "function",
"internal": false,
"description": "Determines if the given node id has the given group name.\nCaches the result for performance. You probably want NodeListMatcher:match_id(node_id).",
"directives": [
{
"directive": "param",
"text": "matcher\t\tNodeListMatcher\t\tThe NodeListMatcher instance to use to make the query.",
"name": "matcher",
"type": "NodeListMatcher",
"description": "The NodeListMatcher instance to use to make the query."
},
{
"directive": "param",
"text": "node_id\t\tnumber\t\t\t\tThe numerical id of the node to check.",
"name": "node_id",
"type": "number",
"description": "The numerical id of the node to check."
},
{
"directive": "param",
"text": "group_name\tstring\t\t\t\tThe name of the group to check if the given node id has.",
"name": "group_name",
"type": "string",
"description": "The name of the group to check if the given node id has."
},
{
"directive": "returns",
"text": "bool\t\tTrue if the given node id belongs to the specified group, and false if it does not.",
"type": "bool",
"description": "True if the given node id belongs to the specified group, and false if it does not."
}
],
"line": 99,
"namespace": "worldeditadditions_core.NodeListMatcher",
"line_last": 105,
"name": "match_group",
"instanced": false,
"args": [
"matcher",
"node_id",
"group_name"
],
"text": "--- Determines if the given node id has the given group name.\n-- Caches the result for performance. You probably want NodeListMatcher:match_id(node_id).\n-- @param\tmatcher\t\tNodeListMatcher\t\tThe NodeListMatcher instance to use to make the query.\n-- @param\tnode_id\t\tnumber\t\t\t\tThe numerical id of the node to check.\n-- @param\tgroup_name\tstring\t\t\t\tThe name of the group to check if the given node id has.\n-- @returns\tbool\t\tTrue if the given node id belongs to the specified group, and false if it does not.\nfunction NodeListMatcher.match_group(matcher, node_id, group_name)",
"params": [
{
"directive": "param",
"text": "matcher\t\tNodeListMatcher\t\tThe NodeListMatcher instance to use to make the query.",
"name": "matcher",
"type": "NodeListMatcher",
"description": "The NodeListMatcher instance to use to make the query."
},
{
"directive": "param",
"text": "node_id\t\tnumber\t\t\t\tThe numerical id of the node to check.",
"name": "node_id",
"type": "number",
"description": "The numerical id of the node to check."
},
{
"directive": "param",
"text": "group_name\tstring\t\t\t\tThe name of the group to check if the given node id has.",
"name": "group_name",
"type": "string",
"description": "The name of the group to check if the given node id has."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\tTrue if the given node id belongs to the specified group, and false if it does not.",
"type": "bool",
"description": "True if the given node id belongs to the specified group, and false if it does not."
},
"examples": [],
"name_full": "worldeditadditions_core.NodeListMatcher.match_group",
"filename": "worldeditadditions_core/utils/NodeListMatcher.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/NodeListMatcher.lua#L100-L106"
}
match_id 🔗
Matches the given node id against the nodelist provided at the instantiation of this NodeListMatcher instance. Returns true if the given node_id matches against any one of the items in the nodelist. In other words, performs a logical OR operation.
We use the term 'item' and not 'node' here since not all items in the nodelist are nodes: nodelists support special keywords such as 'liquidlike' and 'airlike', as well as group names (prefixed with an at sign @).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
matcher | NodeListMatcher | nil | The NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there). |
node_id | number | nil | The numerical id of the node to match against the internal nodelist. |
Returns
bool
:
True if the given node id matches against any of the items in the nodelist.
Source
--- Matches the given node id against the nodelist provided at the instantiation of this NodeListMatcher instance.
-- Returns true if the given node_id matches against any one of the items in the nodelist. In other words, performs a logical OR operation.
--
-- We use the term 'item' and not 'node' here since not all items in the nodelist are nodes: nodelists support special keywords such as 'liquidlike' and 'airlike', as well as group names (prefixed with an at sign @).
-- @param matcher NodeListMatcher The NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there).
-- @param node_id number The numerical id of the node to match against the internal nodelist.
-- @returns bool True if the given node id matches against any of the items in the nodelist.
function NodeListMatcher.match_id(matcher, node_id)
{
"type": "function",
"internal": false,
"description": "Matches the given node id against the nodelist provided at the instantiation of this NodeListMatcher instance.\nReturns true if the given node_id matches against any one of the items in the nodelist. In other words, performs a logical OR operation.\n\nWe use the term 'item' and not 'node' here since not all items in the nodelist are nodes: nodelists support special keywords such as 'liquidlike' and 'airlike', as well as group names (prefixed with an at sign @).",
"directives": [
{
"directive": "param",
"text": "matcher\t\tNodeListMatcher\t\tThe NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there).",
"name": "matcher",
"type": "NodeListMatcher",
"description": "The NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there)."
},
{
"directive": "param",
"text": "node_id\t\tnumber\t\t\t\tThe numerical id of the node to match against the internal nodelist.",
"name": "node_id",
"type": "number",
"description": "The numerical id of the node to match against the internal nodelist."
},
{
"directive": "returns",
"text": "bool\t\tTrue if the given node id matches against any of the items in the nodelist.",
"type": "bool",
"description": "True if the given node id matches against any of the items in the nodelist."
}
],
"line": 73,
"namespace": "worldeditadditions_core.NodeListMatcher",
"line_last": 80,
"name": "match_id",
"instanced": false,
"args": [
"matcher",
"node_id"
],
"text": "--- Matches the given node id against the nodelist provided at the instantiation of this NodeListMatcher instance.\n-- Returns true if the given node_id matches against any one of the items in the nodelist. In other words, performs a logical OR operation.\n-- \n-- We use the term 'item' and not 'node' here since not all items in the nodelist are nodes: nodelists support special keywords such as 'liquidlike' and 'airlike', as well as group names (prefixed with an at sign @).\n-- @param\tmatcher\t\tNodeListMatcher\t\tThe NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there).\n-- @param\tnode_id\t\tnumber\t\t\t\tThe numerical id of the node to match against the internal nodelist.\n-- @returns\tbool\t\tTrue if the given node id matches against any of the items in the nodelist.\nfunction NodeListMatcher.match_id(matcher, node_id)",
"params": [
{
"directive": "param",
"text": "matcher\t\tNodeListMatcher\t\tThe NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there).",
"name": "matcher",
"type": "NodeListMatcher",
"description": "The NodeListMatcher instance to query against. Use some_matcher:match_id(node_id) to avoid specifying this manually (note the colon : and not a dot . there)."
},
{
"directive": "param",
"text": "node_id\t\tnumber\t\t\t\tThe numerical id of the node to match against the internal nodelist.",
"name": "node_id",
"type": "number",
"description": "The numerical id of the node to match against the internal nodelist."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\tTrue if the given node id matches against any of the items in the nodelist.",
"type": "bool",
"description": "True if the given node id matches against any of the items in the nodelist."
},
"examples": [],
"name_full": "worldeditadditions_core.NodeListMatcher.match_id",
"filename": "worldeditadditions_core/utils/NodeListMatcher.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/NodeListMatcher.lua#L74-L81"
}
new 🔗
Creates a new NodeListMatcher instance with the given node list. Once created, you probably want to call the :match_id(node_id) function.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
nodelist | string[] | nil | The list of nodes to match against.
Node names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group. |
Returns
bool,string|NodeListMatcher
:
A success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance.
Source
--- Creates a new NodeListMatcher instance with the given node list.
-- Once created, you probably want to call the :match_id(node_id) function.
-- @param nodelist string[] The list of nodes to match against.
--
-- `airlike` and `liquidlike` are special keywords that instead check if a given node id behaves like air or a liquid respectively.
--
-- Node names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group.
-- @returns bool,string|NodeListMatcher A success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance.
function NodeListMatcher.new(nodelist)
{
"type": "function",
"internal": false,
"description": "Creates a new NodeListMatcher instance with the given node list.\nOnce created, you probably want to call the :match_id(node_id) function.",
"directives": [
{
"directive": "param",
"text": "nodelist\tstring[]\tThe list of nodes to match against.\n\n`airlike` and `liquidlike` are special keywords that instead check if a given node id behaves like air or a liquid respectively.\n\nNode names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group.",
"name": "nodelist",
"type": "string[]",
"description": "The list of nodes to match against.\n\n`airlike` and `liquidlike` are special keywords that instead check if a given node id behaves like air or a liquid respectively.\n\nNode names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group."
},
{
"directive": "returns",
"text": "bool,string|NodeListMatcher\t\t\tA success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance.",
"type": "bool,string|NodeListMatcher",
"description": "A success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance."
}
],
"line": 51,
"namespace": "worldeditadditions_core.NodeListMatcher",
"line_last": 59,
"name": "new",
"instanced": false,
"args": [
"nodelist"
],
"text": "--- Creates a new NodeListMatcher instance with the given node list.\n-- Once created, you probably want to call the :match_id(node_id) function.\n-- @param\tnodelist\tstring[]\tThe list of nodes to match against.\n-- \n-- `airlike` and `liquidlike` are special keywords that instead check if a given node id behaves like air or a liquid respectively.\n-- \n-- Node names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group.\n-- @returns\tbool,string|NodeListMatcher\t\t\tA success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance.\nfunction NodeListMatcher.new(nodelist)",
"params": [
{
"directive": "param",
"text": "nodelist\tstring[]\tThe list of nodes to match against.\n\n`airlike` and `liquidlike` are special keywords that instead check if a given node id behaves like air or a liquid respectively.\n\nNode names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group.",
"name": "nodelist",
"type": "string[]",
"description": "The list of nodes to match against.\n\n`airlike` and `liquidlike` are special keywords that instead check if a given node id behaves like air or a liquid respectively.\n\nNode names prefixed with an at sign (@) are considered group names, and given node ids are checked for membership of the given group."
}
],
"returns": {
"directive": "returns",
"text": "bool,string|NodeListMatcher\t\t\tA success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance.",
"type": "bool,string|NodeListMatcher",
"description": "A success bool (true == success), and then either a string (if succes == false) or otherwise the newly created NodeListMatcher instance."
},
"examples": [],
"name_full": "worldeditadditions_core.NodeListMatcher.new",
"filename": "worldeditadditions_core/utils/NodeListMatcher.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/NodeListMatcher.lua#L52-L60"
}
notify 🔗
WorldEditAdditions player notification system.
validate 🔗
Validation functions for WorldEditAdditions notifications.
Functions
custom 🔗
Send a custom notification.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to send the notification to. |
ntype | string | nil | The type of notification. |
message | string | nil | The message to send. |
colour | string? | nil | Optional. The colour of the notification. |
message_coloured | boolean? | nil | Optional. Whether the message should be coloured. |
Returns
boolean
:
True if all parameters are valid, false otherwise.
Examples
Custom notification types
Notify.custom(name, "custom", "This one is magenta!", "#FF00FF", true)
Notify.custom(name, "custom", "This one is gold with white text!", "#FFC700")
Source
--- Send a custom notification.
-- @param name string The name of the player to send the notification to.
-- @param ntype string The type of notification.
-- @param message string The message to send.
-- @param colour string? Optional. The colour of the notification.
-- @param message_coloured boolean? Optional. Whether the message should be coloured.
-- @return boolean True if all parameters are valid, false otherwise.
-- @example Custom notification types
-- Notify.custom(name, "custom", "This one is magenta!", "#FF00FF", true)
-- Notify.custom(name, "custom", "This one is gold with white text!", "#FFC700")
function Notify.custom(name, ntype, message, colour, message_coloured)
{
"type": "function",
"internal": false,
"description": "Send a custom notification.",
"directives": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to send the notification to.",
"name": "name",
"type": "string",
"description": "The name of the player to send the notification to."
},
{
"directive": "param",
"text": "ntype\tstring\t\tThe type of notification.",
"name": "ntype",
"type": "string",
"description": "The type of notification."
},
{
"directive": "param",
"text": "message\tstring\t\tThe message to send.",
"name": "message",
"type": "string",
"description": "The message to send."
},
{
"directive": "param",
"text": "colour\tstring?\t\tOptional. The colour of the notification.",
"name": "colour",
"type": "string?",
"description": "Optional. The colour of the notification."
},
{
"directive": "param",
"text": "message_coloured\tboolean?\tOptional. Whether the message should be coloured.",
"name": "message_coloured",
"type": "boolean?",
"description": "Optional. Whether the message should be coloured."
},
{
"directive": "returns",
"text": "boolean\t\t\tTrue if all parameters are valid, false otherwise.",
"type": "boolean",
"description": "True if all parameters are valid, false otherwise."
},
{
"directive": "example",
"text": "Custom notification types\nNotify.custom(name, \"custom\", \"This one is magenta!\", \"#FF00FF\", true)\nNotify.custom(name, \"custom\", \"This one is gold with white text!\", \"#FFC700\")",
"description": "Custom notification types",
"example": "Notify.custom(name, \"custom\", \"This one is magenta!\", \"#FF00FF\", true)\nNotify.custom(name, \"custom\", \"This one is gold with white text!\", \"#FFC700\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">custom</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">custom</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">This one is magenta!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">#FF00FF</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4D9375\">true</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">custom</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">custom</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">This one is gold with white text!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">#FFC700</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"line": 82,
"namespace": "worldeditadditions_core.notify",
"line_last": 92,
"name": "custom",
"instanced": false,
"args": [
"name",
"ntype",
"message",
"colour",
"message_coloured"
],
"text": "--- Send a custom notification.\n-- @param\tname\tstring\t\tThe name of the player to send the notification to.\n-- @param\tntype\tstring\t\tThe type of notification.\n-- @param\tmessage\tstring\t\tThe message to send.\n-- @param\tcolour\tstring?\t\tOptional. The colour of the notification.\n-- @param\tmessage_coloured\tboolean?\tOptional. Whether the message should be coloured.\n-- @return\tboolean\t\t\tTrue if all parameters are valid, false otherwise.\n-- @example\t\tCustom notification types\n-- Notify.custom(name, \"custom\", \"This one is magenta!\", \"#FF00FF\", true)\n-- Notify.custom(name, \"custom\", \"This one is gold with white text!\", \"#FFC700\")\nfunction Notify.custom(name, ntype, message, colour, message_coloured)",
"params": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to send the notification to.",
"name": "name",
"type": "string",
"description": "The name of the player to send the notification to."
},
{
"directive": "param",
"text": "ntype\tstring\t\tThe type of notification.",
"name": "ntype",
"type": "string",
"description": "The type of notification."
},
{
"directive": "param",
"text": "message\tstring\t\tThe message to send.",
"name": "message",
"type": "string",
"description": "The message to send."
},
{
"directive": "param",
"text": "colour\tstring?\t\tOptional. The colour of the notification.",
"name": "colour",
"type": "string?",
"description": "Optional. The colour of the notification."
},
{
"directive": "param",
"text": "message_coloured\tboolean?\tOptional. Whether the message should be coloured.",
"name": "message_coloured",
"type": "boolean?",
"description": "Optional. Whether the message should be coloured."
}
],
"returns": {
"directive": "returns",
"text": "boolean\t\t\tTrue if all parameters are valid, false otherwise.",
"type": "boolean",
"description": "True if all parameters are valid, false otherwise."
},
"examples": [
{
"directive": "example",
"text": "Custom notification types\nNotify.custom(name, \"custom\", \"This one is magenta!\", \"#FF00FF\", true)\nNotify.custom(name, \"custom\", \"This one is gold with white text!\", \"#FFC700\")",
"description": "Custom notification types",
"example": "Notify.custom(name, \"custom\", \"This one is magenta!\", \"#FF00FF\", true)\nNotify.custom(name, \"custom\", \"This one is gold with white text!\", \"#FFC700\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">custom</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">custom</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">This one is magenta!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">#FF00FF</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4D9375\">true</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">custom</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">custom</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">This one is gold with white text!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">#FFC700</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.notify.custom",
"filename": "worldeditadditions_core/utils/notify/notify.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/notify.lua#L83-L93"
}
suppress_for_function 🔗
Suppress a player's notifications while function executes.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to suppress. |
func | function | nil | The function to execute while the player is suppressed. |
Returns
bool, string
:
Success, result of the executed function.
Source
--- Suppress a player's notifications while function executes.
-- @param name string The name of the player to suppress.
-- @param func function The function to execute while the player is suppressed.
-- @returns bool, string Success, result of the executed function.
function Notify.suppress_for_function(name, func)
{
"type": "function",
"internal": false,
"description": "Suppress a player's notifications while function executes.",
"directives": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to suppress.",
"name": "name",
"type": "string",
"description": "The name of the player to suppress."
},
{
"directive": "param",
"text": "func\tfunction\tThe function to execute while the player is suppressed.",
"name": "func",
"type": "function",
"description": "The function to execute while the player is suppressed."
},
{
"directive": "returns",
"text": "bool, string\t\tSuccess, result of the executed function.",
"type": "bool, string",
"description": "Success, result of the executed function."
}
],
"line": 150,
"namespace": "worldeditadditions_core.notify",
"line_last": 154,
"name": "suppress_for_function",
"instanced": false,
"args": [
"name",
"func"
],
"text": "--- Suppress a player's notifications while function executes.\n-- @param\tname\tstring\t\tThe name of the player to suppress.\n-- @param\tfunc\tfunction\tThe function to execute while the player is suppressed.\n-- @returns\tbool, string\t\tSuccess, result of the executed function.\nfunction Notify.suppress_for_function(name, func)",
"params": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to suppress.",
"name": "name",
"type": "string",
"description": "The name of the player to suppress."
},
{
"directive": "param",
"text": "func\tfunction\tThe function to execute while the player is suppressed.",
"name": "func",
"type": "function",
"description": "The function to execute while the player is suppressed."
}
],
"returns": {
"directive": "returns",
"text": "bool, string\t\tSuccess, result of the executed function.",
"type": "bool, string",
"description": "Success, result of the executed function."
},
"examples": [],
"name_full": "worldeditadditions_core.notify.suppress_for_function",
"filename": "worldeditadditions_core/utils/notify/notify.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/notify.lua#L151-L155"
}
suppress_for_player 🔗
Suppress a player's notifications.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to suppress. |
time | number > 1 | nil | The number of seconds to suppress notifications for. |
Returns
nil
Source
--- Suppress a player's notifications.
-- @param name string The name of the player to suppress.
-- @param time number > 1 The number of seconds to suppress notifications for.
-- number < 1 immediately removes the suppression.
function Notify.suppress_for_player(name, time)
{
"type": "function",
"internal": false,
"description": "Suppress a player's notifications.",
"directives": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to suppress.",
"name": "name",
"type": "string",
"description": "The name of the player to suppress."
},
{
"directive": "param",
"text": "time\tnumber > 1\tThe number of seconds to suppress notifications for.\n\t\t\t\t\t\t\tnumber < 1 immediately removes the suppression.",
"name": "time",
"type": "number > 1",
"description": "The number of seconds to suppress notifications for.\n"
}
],
"line": 135,
"namespace": "worldeditadditions_core.notify",
"line_last": 139,
"name": "suppress_for_player",
"instanced": false,
"args": [
"name",
"time"
],
"text": "--- Suppress a player's notifications.\n-- @param\tname\tstring\t\tThe name of the player to suppress.\n-- @param\ttime\tnumber > 1\tThe number of seconds to suppress notifications for.\n--\t\t\t\t\t\t\t\tnumber < 1 immediately removes the suppression.\nfunction Notify.suppress_for_player(name, time)",
"params": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to suppress.",
"name": "name",
"type": "string",
"description": "The name of the player to suppress."
},
{
"directive": "param",
"text": "time\tnumber > 1\tThe number of seconds to suppress notifications for.\n\t\t\t\t\t\t\tnumber < 1 immediately removes the suppression.",
"name": "time",
"type": "number > 1",
"description": "The number of seconds to suppress notifications for.\n"
}
],
"examples": [],
"name_full": "worldeditadditions_core.notify.suppress_for_player",
"filename": "worldeditadditions_core/utils/notify/notify.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/notify.lua#L136-L140"
}
🔗
Send a notification of type ntype
(for metatable). (Same as Notify[ntype](name, message)
)
Arguments
Name | Type | Default value | Description |
---|---|---|---|
_self | table | nil | Provided automatically by Lua. You do not need to set this automatically - see example. |
name | string | nil | The name of the player to send the notification to. |
ntype | string | nil | The type of notification. |
message | string | nil | The message to send. |
Returns
table
:
The Notify instance.
Examples
Basic usage
worldeditadditions_core.notify(player_name, "info", "All registered commands:\n....")
Source
--- Send a notification of type `ntype` (for metatable).
-- (Same as `Notify[ntype](name, message)`)
-- @param _self table Provided automatically by Lua. You do not need to set this automatically - see example.
-- @param name string The name of the player to send the notification to.
-- @param ntype string The type of notification.
-- @param message string The message to send.
-- @return table The Notify instance.
-- @example Basic usage
-- worldeditadditions_core.notify(player_name, "info", "All registered commands:\n....")
local call = function(_self, name, ntype, message)
{
"type": "function",
"internal": false,
"description": "Send a notification of type `ntype` (for metatable).\n (Same as `Notify[ntype](name, message)`)",
"directives": [
{
"directive": "param",
"text": "_self\ttable\tProvided automatically by Lua. You do not need to set this automatically - see example.",
"name": "_self",
"type": "table",
"description": "Provided automatically by Lua. You do not need to set this automatically - see example."
},
{
"directive": "param",
"text": "name\tstring\tThe name of the player to send the notification to.",
"name": "name",
"type": "string",
"description": "The name of the player to send the notification to."
},
{
"directive": "param",
"text": "ntype\tstring\tThe type of notification.",
"name": "ntype",
"type": "string",
"description": "The type of notification."
},
{
"directive": "param",
"text": "message\tstring\tThe message to send.",
"name": "message",
"type": "string",
"description": "The message to send."
},
{
"directive": "returns",
"text": "table\tThe Notify instance.",
"type": "table",
"description": "The Notify instance."
},
{
"directive": "example",
"text": "Basic usage\nworldeditadditions_core.notify(player_name, \"info\", \"All registered commands:\\n....\")",
"description": "Basic usage",
"example": "worldeditadditions_core.notify(player_name, \"info\", \"All registered commands:\\n....\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#BD976A\">worldeditadditions_core</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">notify</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">player_name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">info</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">All registered commands:</span><span style=\"color:#C99076\">\\n</span><span style=\"color:#C98A7D\">....</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"line": 61,
"namespace": "worldeditadditions_core.notify",
"line_last": 70,
"text": "--- Send a notification of type `ntype` (for metatable).\n-- (Same as `Notify[ntype](name, message)`)\n-- @param\t_self\ttable\tProvided automatically by Lua. You do not need to set this automatically - see example.\n-- @param\tname\tstring\tThe name of the player to send the notification to.\n-- @param\tntype\tstring\tThe type of notification.\n-- @param\tmessage\tstring\tThe message to send.\n-- @return\ttable\tThe Notify instance.\n-- @example Basic usage\n-- worldeditadditions_core.notify(player_name, \"info\", \"All registered commands:\\n....\")\nlocal call = function(_self, name, ntype, message)",
"params": [
{
"directive": "param",
"text": "_self\ttable\tProvided automatically by Lua. You do not need to set this automatically - see example.",
"name": "_self",
"type": "table",
"description": "Provided automatically by Lua. You do not need to set this automatically - see example."
},
{
"directive": "param",
"text": "name\tstring\tThe name of the player to send the notification to.",
"name": "name",
"type": "string",
"description": "The name of the player to send the notification to."
},
{
"directive": "param",
"text": "ntype\tstring\tThe type of notification.",
"name": "ntype",
"type": "string",
"description": "The type of notification."
},
{
"directive": "param",
"text": "message\tstring\tThe message to send.",
"name": "message",
"type": "string",
"description": "The message to send."
}
],
"returns": {
"directive": "returns",
"text": "table\tThe Notify instance.",
"type": "table",
"description": "The Notify instance."
},
"examples": [
{
"directive": "example",
"text": "Basic usage\nworldeditadditions_core.notify(player_name, \"info\", \"All registered commands:\\n....\")",
"description": "Basic usage",
"example": "worldeditadditions_core.notify(player_name, \"info\", \"All registered commands:\\n....\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#BD976A\">worldeditadditions_core</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">notify</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">player_name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">info</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">All registered commands:</span><span style=\"color:#C99076\">\\n</span><span style=\"color:#C98A7D\">....</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.notify.undefined",
"filename": "worldeditadditions_core/utils/notify/notify.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/notify.lua#L62-L71"
}
🔗
Register the aforementioned predefined notification types.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to send the notification to. |
message | string | nil | The message to send. |
Returns
nil
Examples
Example 1
Notify.error(name, "multi-line error!\n" .. debug.traceback())
Notify.warn(name, "This is the last coloured message type!")
Notify.ok(name, "I am ok!")
Notify.info(name, "There once was a ship that put to sea...")
Source
--- Register the aforementioned predefined notification types.
-- @param name string The name of the player to send the notification to.
-- @param message string The message to send.
-- @example
-- Notify.error(name, "multi-line error!\n" .. debug.traceback())
-- Notify.warn(name, "This is the last coloured message type!")
-- Notify.ok(name, "I am ok!")
-- Notify.info(name, "There once was a ship that put to sea...")
do
{
"type": "function",
"internal": false,
"description": "Register the aforementioned predefined notification types.",
"directives": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to send the notification to.",
"name": "name",
"type": "string",
"description": "The name of the player to send the notification to."
},
{
"directive": "param",
"text": "message\tstring\tThe message to send.",
"name": "message",
"type": "string",
"description": "The message to send."
},
{
"directive": "example",
"text": "Notify.error(name, \"multi-line error!\\n\" .. debug.traceback())\nNotify.warn(name, \"This is the last coloured message type!\")\nNotify.ok(name, \"I am ok!\")\nNotify.info(name, \"There once was a ship that put to sea...\")",
"description": "Example 1",
"example": "Notify.error(name, \"multi-line error!\\n\" .. debug.traceback())\nNotify.warn(name, \"This is the last coloured message type!\")\nNotify.ok(name, \"I am ok!\")\nNotify.info(name, \"There once was a ship that put to sea...\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">error</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">multi-line error!</span><span style=\"color:#C99076\">\\n</span><span style=\"color:#C98A7D77\">\" </span><span style=\"color:#CB7676\">..</span><span style=\"color:#B8A965\"> debug.traceback</span><span style=\"color:#DBD7CAEE\">())</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">warn</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">This is the last coloured message type!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">ok</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">I am ok!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">info</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">There once was a ship that put to sea...</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"line": 98,
"namespace": "worldeditadditions_core.notify",
"line_last": 106,
"text": "--- Register the aforementioned predefined notification types.\n-- @param\tname\tstring\tThe name of the player to send the notification to.\n-- @param\tmessage\tstring\tThe message to send.\n-- @example\n-- Notify.error(name, \"multi-line error!\\n\" .. debug.traceback())\n-- Notify.warn(name, \"This is the last coloured message type!\")\n-- Notify.ok(name, \"I am ok!\")\n-- Notify.info(name, \"There once was a ship that put to sea...\")\ndo",
"params": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to send the notification to.",
"name": "name",
"type": "string",
"description": "The name of the player to send the notification to."
},
{
"directive": "param",
"text": "message\tstring\tThe message to send.",
"name": "message",
"type": "string",
"description": "The message to send."
}
],
"examples": [
{
"directive": "example",
"text": "Notify.error(name, \"multi-line error!\\n\" .. debug.traceback())\nNotify.warn(name, \"This is the last coloured message type!\")\nNotify.ok(name, \"I am ok!\")\nNotify.info(name, \"There once was a ship that put to sea...\")",
"description": "Example 1",
"example": "Notify.error(name, \"multi-line error!\\n\" .. debug.traceback())\nNotify.warn(name, \"This is the last coloured message type!\")\nNotify.ok(name, \"I am ok!\")\nNotify.info(name, \"There once was a ship that put to sea...\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">error</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">multi-line error!</span><span style=\"color:#C99076\">\\n</span><span style=\"color:#C98A7D77\">\" </span><span style=\"color:#CB7676\">..</span><span style=\"color:#B8A965\"> debug.traceback</span><span style=\"color:#DBD7CAEE\">())</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">warn</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">This is the last coloured message type!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">ok</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">I am ok!</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">Notify</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">info</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#BD976A\">name</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">There once was a ship that put to sea...</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.notify.undefined",
"filename": "worldeditadditions_core/utils/notify/notify.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/notify.lua#L99-L107"
}
🔗
Local suppression status handler
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to check. |
suppress | table | nil | The table of suppressed players. |
Returns
boolean
:
True if the player is not suppressed or
Source
--- Local suppression status handler
-- @param name string The name of the player to check.
-- @param suppress table The table of suppressed players.
-- @return boolean True if the player is not suppressed or
-- if the player is clear(ed), false otherwise.
local check_clear_suppressed = function(name, suppress)
{
"type": "function",
"internal": false,
"description": "Local suppression status handler",
"directives": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to check.",
"name": "name",
"type": "string",
"description": "The name of the player to check."
},
{
"directive": "param",
"text": "suppress\ttable\tThe table of suppressed players.",
"name": "suppress",
"type": "table",
"description": "The table of suppressed players."
},
{
"directive": "returns",
"text": "boolean\t\tTrue if the player is not suppressed or\n\t\t\t\t\tif the player is clear(ed), false otherwise.",
"type": "boolean",
"description": "True if the player is not suppressed or\n"
}
],
"line": 120,
"namespace": "worldeditadditions_core.notify",
"line_last": 125,
"text": "--- Local suppression status handler\n-- @param\tname\tstring\t\tThe name of the player to check.\n-- @param\tsuppress\ttable\tThe table of suppressed players.\n-- @return\tboolean\t\tTrue if the player is not suppressed or\n--\t\t\t\t\t\tif the player is clear(ed), false otherwise.\nlocal check_clear_suppressed = function(name, suppress)",
"params": [
{
"directive": "param",
"text": "name\tstring\t\tThe name of the player to check.",
"name": "name",
"type": "string",
"description": "The name of the player to check."
},
{
"directive": "param",
"text": "suppress\ttable\tThe table of suppressed players.",
"name": "suppress",
"type": "table",
"description": "The table of suppressed players."
}
],
"returns": {
"directive": "returns",
"text": "boolean\t\tTrue if the player is not suppressed or\n\t\t\t\t\tif the player is clear(ed), false otherwise.",
"type": "boolean",
"description": "True if the player is not suppressed or\n"
},
"examples": [],
"name_full": "worldeditadditions_core.notify.undefined",
"filename": "worldeditadditions_core/utils/notify/notify.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/notify/notify.lua#L121-L126"
}
orientation 🔗
Functions to rotate a facedir/wallmounted value around an axis by a certain amount
Code lifted from @12Me21 and @khonkhortisan
Ref <https://github.com/12Me21/screwdriver2/blob/master/init.lua#L75-L79> and <https://forum.minetest.net/viewtopic.php?p=73195&sid=1d2d2e4e76ce2ef9c84646481a4b84bc#p73195>
Functions
facedir 🔗
Facedir: lower 5 bits used for direction, 0 - 23
Arguments
Name | Type | Default value | Description |
---|---|---|---|
param2 | number | nil |
|
axis | string | nil | The name of the axis to rotate around. Valid values: |
amount | The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**! | nil |
Returns
number
:
A new param2 value that is rotated the given number of degrees around the given axis
Source
--- Facedir: lower 5 bits used for direction, 0 - 23
-- @param param2 number `param2` value to rotate.
-- @param axis string The name of the axis to rotate around. Valid values: `x`, `y`, `z`
-- @param amount The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!
-- @returns number A new param2 value that is rotated the given number of degrees around the given `axis`
local function facedir(param2, axis, amount_rad)
{
"type": "function",
"internal": false,
"description": "Facedir: lower 5 bits used for direction, 0 - 23",
"directives": [
{
"directive": "param",
"text": "param2\tnumber\t`param2` value to rotate.",
"name": "param2",
"type": "number",
"description": "`param2` value to rotate."
},
{
"directive": "param",
"text": "axis\tstring\tThe name of the axis to rotate around. Valid values: `x`, `y`, `z`",
"name": "axis",
"type": "string",
"description": "The name of the axis to rotate around. Valid values: `x`, `y`, `z`"
},
{
"directive": "param",
"text": "amount\tThe number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!",
"name": "amount",
"type": "The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!"
},
{
"directive": "returns",
"text": "number\tA new param2 value that is rotated the given number of degrees around the given `axis`",
"type": "number",
"description": "A new param2 value that is rotated the given number of degrees around the given `axis`"
}
],
"line": 32,
"namespace": "worldeditadditions_core.orientation",
"line_last": 37,
"name": "facedir",
"instanced": false,
"args": [
"param2",
"axis",
"amount_rad"
],
"text": "--- Facedir: lower 5 bits used for direction, 0 - 23\n-- @param\tparam2\tnumber\t`param2` value to rotate.\n-- @param\taxis\tstring\tThe name of the axis to rotate around. Valid values: `x`, `y`, `z`\n-- @param\tamount\tThe number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!\n-- @returns\tnumber\tA new param2 value that is rotated the given number of degrees around the given `axis`\nlocal function facedir(param2, axis, amount_rad)",
"params": [
{
"directive": "param",
"text": "param2\tnumber\t`param2` value to rotate.",
"name": "param2",
"type": "number",
"description": "`param2` value to rotate."
},
{
"directive": "param",
"text": "axis\tstring\tThe name of the axis to rotate around. Valid values: `x`, `y`, `z`",
"name": "axis",
"type": "string",
"description": "The name of the axis to rotate around. Valid values: `x`, `y`, `z`"
},
{
"directive": "param",
"text": "amount\tThe number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!",
"name": "amount",
"type": "The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!"
}
],
"returns": {
"directive": "returns",
"text": "number\tA new param2 value that is rotated the given number of degrees around the given `axis`",
"type": "number",
"description": "A new param2 value that is rotated the given number of degrees around the given `axis`"
},
"examples": [],
"name_full": "worldeditadditions_core.orientation.facedir",
"filename": "worldeditadditions_core/utils/orientation.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/orientation.lua#L33-L38"
}
wallmounted 🔗
Wallmounted: lower 3 bits used, 0 - 5
Arguments
Name | Type | Default value | Description |
---|---|---|---|
param2 | number | nil |
|
axis | string | nil | The name of the axis to rotate around. Valid values: |
amount | The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**! | nil |
Returns
number
:
A new param2 value that is rotated the given number of degrees around the given axis
Source
--- Wallmounted: lower 3 bits used, 0 - 5
-- @param param2 number `param2` value to rotate.
-- @param axis string The name of the axis to rotate around. Valid values: `x`, `y`, `z`
-- @param amount The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!
-- @returns number A new param2 value that is rotated the given number of degrees around the given `axis`
local function wallmounted(param2, axis, amount_rad)
{
"type": "function",
"internal": false,
"description": "Wallmounted: lower 3 bits used, 0 - 5",
"directives": [
{
"directive": "param",
"text": "param2\tnumber\t`param2` value to rotate.",
"name": "param2",
"type": "number",
"description": "`param2` value to rotate."
},
{
"directive": "param",
"text": "axis\tstring\tThe name of the axis to rotate around. Valid values: `x`, `y`, `z`",
"name": "axis",
"type": "string",
"description": "The name of the axis to rotate around. Valid values: `x`, `y`, `z`"
},
{
"directive": "param",
"text": "amount\tThe number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!",
"name": "amount",
"type": "The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!"
},
{
"directive": "returns",
"text": "number\tA new param2 value that is rotated the given number of degrees around the given `axis`",
"type": "number",
"description": "A new param2 value that is rotated the given number of degrees around the given `axis`"
}
],
"line": 53,
"namespace": "worldeditadditions_core.orientation",
"line_last": 58,
"name": "wallmounted",
"instanced": false,
"args": [
"param2",
"axis",
"amount_rad"
],
"text": "--- Wallmounted: lower 3 bits used, 0 - 5\n-- @param\tparam2\tnumber\t`param2` value to rotate.\n-- @param\taxis\tstring\tThe name of the axis to rotate around. Valid values: `x`, `y`, `z`\n-- @param\tamount\tThe number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!\n-- @returns\tnumber\tA new param2 value that is rotated the given number of degrees around the given `axis`\nlocal function wallmounted(param2, axis, amount_rad)",
"params": [
{
"directive": "param",
"text": "param2\tnumber\t`param2` value to rotate.",
"name": "param2",
"type": "number",
"description": "`param2` value to rotate."
},
{
"directive": "param",
"text": "axis\tstring\tThe name of the axis to rotate around. Valid values: `x`, `y`, `z`",
"name": "axis",
"type": "string",
"description": "The name of the axis to rotate around. Valid values: `x`, `y`, `z`"
},
{
"directive": "param",
"text": "amount\tThe number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!",
"name": "amount",
"type": "The number of radians to rotate around the given `axis`. Only right angles are supported (i.e. 90° increments). Any value that isn't a 90° increment will be **rounded**!"
}
],
"returns": {
"directive": "returns",
"text": "number\tA new param2 value that is rotated the given number of degrees around the given `axis`",
"type": "number",
"description": "A new param2 value that is rotated the given number of degrees around the given `axis`"
},
"examples": [],
"name_full": "worldeditadditions_core.orientation.wallmounted",
"filename": "worldeditadditions_core/utils/orientation.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/orientation.lua#L54-L59"
}
param2 🔗
Functions
orient 🔗
Rotates the given param2 value of the given type by the given COMPILED list of rotations. In other words, reorients a given param2 value of a given param2_type (aka paramtype2 in the Minetest engine but the Minetest engine naming scheme is dumb in this case) according to a given COMPILED rotation list.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
param2 | number | nil | The param2 value to rotate. |
param2_type | string | nil | The type of param2 value we're talking about here. Currently, only a value of |
rotlist_c | Vector3[] | nil | The list of vector rotations to apply to param2. Call |
Returns
number?
:
Returns the rotated param2 value, or nil if an invalid param2_type value was passed.
Source
--- Rotates the given param2 value of the given type by the given COMPILED list of rotations.
-- In other words, reorients a given param2 value of a given param2_type (aka paramtype2 in the Minetest engine but the Minetest engine naming scheme is dumb in this case) according to a given COMPILED rotation list.
-- @param param2 number The param2 value to rotate.
-- @param param2_type string The type of param2 value we're talking about here. Currently, only a value of `facedir` is supported.
-- @param rotlist_c Vector3[] The list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d.
-- @returns number? Returns the rotated param2 value, or nil if an invalid param2_type value was passed.
local function orient(param2, param2_type, rotlist_c)
{
"type": "function",
"internal": false,
"description": "Rotates the given param2 value of the given type by the given COMPILED list of rotations.\nIn other words, reorients a given param2 value of a given param2_type (aka paramtype2 in the Minetest engine but the Minetest engine naming scheme is dumb in this case) according to a given COMPILED rotation list.",
"directives": [
{
"directive": "param",
"text": "param2\t\tnumber\t\tThe param2 value to rotate.",
"name": "param2",
"type": "number",
"description": "The param2 value to rotate."
},
{
"directive": "param",
"text": "param2_type\tstring\t\tThe type of param2 value we're talking about here. Currently, only a value of `facedir` is supported.",
"name": "param2_type",
"type": "string",
"description": "The type of param2 value we're talking about here. Currently, only a value of `facedir` is supported."
},
{
"directive": "param",
"text": "rotlist_c\tVector3[]\tThe list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d.",
"name": "rotlist_c",
"type": "Vector3[]",
"description": "The list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d."
},
{
"directive": "returns",
"text": "number?\t\tReturns the rotated param2 value, or nil if an invalid param2_type value was passed.",
"type": "number?",
"description": "Returns the rotated param2 value, or nil if an invalid param2_type value was passed."
}
],
"line": 30,
"namespace": "worldeditadditions_core.param2",
"line_last": 36,
"name": "orient",
"instanced": false,
"args": [
"param2",
"param2_type",
"rotlist_c"
],
"text": "--- Rotates the given param2 value of the given type by the given COMPILED list of rotations.\n-- In other words, reorients a given param2 value of a given param2_type (aka paramtype2 in the Minetest engine but the Minetest engine naming scheme is dumb in this case) according to a given COMPILED rotation list. \n-- @param\tparam2\t\tnumber\t\tThe param2 value to rotate.\n-- @param\tparam2_type\tstring\t\tThe type of param2 value we're talking about here. Currently, only a value of `facedir` is supported.\n-- @param\trotlist_c\tVector3[]\tThe list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d.\n-- @returns\tnumber?\t\tReturns the rotated param2 value, or nil if an invalid param2_type value was passed.\nlocal function orient(param2, param2_type, rotlist_c)",
"params": [
{
"directive": "param",
"text": "param2\t\tnumber\t\tThe param2 value to rotate.",
"name": "param2",
"type": "number",
"description": "The param2 value to rotate."
},
{
"directive": "param",
"text": "param2_type\tstring\t\tThe type of param2 value we're talking about here. Currently, only a value of `facedir` is supported.",
"name": "param2_type",
"type": "string",
"description": "The type of param2 value we're talking about here. Currently, only a value of `facedir` is supported."
},
{
"directive": "param",
"text": "rotlist_c\tVector3[]\tThe list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d.",
"name": "rotlist_c",
"type": "Vector3[]",
"description": "The list of vector rotations to apply to param2. Call `worldeditadditions_core.rotation.rotlist_compile` on a rotation list to get this value. Each one is iteratively applied using the `rotate` argument to Vector3.rotate3d."
}
],
"returns": {
"directive": "returns",
"text": "number?\t\tReturns the rotated param2 value, or nil if an invalid param2_type value was passed.",
"type": "number?",
"description": "Returns the rotated param2 value, or nil if an invalid param2_type value was passed."
},
"examples": [],
"name_full": "worldeditadditions_core.param2.orient",
"filename": "worldeditadditions_core/utils/param2.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/param2.lua#L31-L37"
}
parse 🔗
Functions for parsing things.
file 🔗
Parsers specifically for file formats.
weaschem 🔗
Library for parsing .weaschem WorldEditAdditions Schematic files.
Most of these functions return 3 values rather than the usual 2. This might seem overcomplicated, but it enables a higher level of validation in automated testing. These 3 return values take the following form:
- bool: A success/failure bool.
true
means success, andfalse
, means failure. - string: The error code. "SUCCESS" if #1 (the bool) is
true
. Otherwise set to a code to indicate exactly which error ocurred. - any|string: EITHER the expected return value, OR a string with a human-readable error message if
bool=false
.
Functions
parse 🔗
Parses the WorldEditAdditions schematic file from the given handle. This requires a file handle, as significant optimisations can be made in the case of invalid files.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
handle | File | nil | A Lua file handle to read from. |
[delta_which | string | both] | If the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state). |
Returns
bool,string,table|string
:
- Success bool (
true
== success) - Error code. "SUCCESS" is passed if the operation was successful.
- Either the resulting Lua table if parsing was successful, or an error message as a string if not.
Source
--- Parses the WorldEditAdditions schematic file from the given handle.
-- This requires a file handle, as significant optimisations can be made in the case of invalid files.
-- @param handle File A Lua file handle to read from.
-- @param [delta_which=both] string If the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state).
-- @returns bool,string,table|string 1. Success bool (`true` == success)
-- 2. Error code. "SUCCESS" is passed if the operation was successful.
-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.
function weaschem.parse(handle, delta_which)
{
"type": "function",
"internal": false,
"description": "Parses the WorldEditAdditions schematic file from the given handle.\nThis requires a file handle, as significant optimisations can be made in the case of invalid files.",
"directives": [
{
"directive": "param",
"text": "handle\t\tFile\tA Lua file handle to read from.",
"name": "handle",
"type": "File",
"description": "A Lua file handle to read from."
},
{
"directive": "param",
"text": "[delta_which=both]\tstring\tIf the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state).",
"name": "[delta_which",
"type": "string",
"description": "If the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state).",
"default_value": "both]"
},
{
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
}
],
"line": 222,
"namespace": "worldeditadditions_core.parse.file.weaschem",
"line_last": 229,
"name": "parse",
"instanced": false,
"args": [
"handle",
"delta_which"
],
"text": "--- Parses the WorldEditAdditions schematic file from the given handle.\n-- This requires a file handle, as significant optimisations can be made in the case of invalid files.\n-- @param\thandle\t\tFile\tA Lua file handle to read from.\n-- @param\t[delta_which=both]\tstring\tIf the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state).\n-- @returns\tbool,string,table|string\t1. Success bool (`true` == success)\n-- 2. Error code. \"SUCCESS\" is passed if the operation was successful.\n-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.\nfunction weaschem.parse(handle, delta_which)",
"params": [
{
"directive": "param",
"text": "handle\t\tFile\tA Lua file handle to read from.",
"name": "handle",
"type": "File",
"description": "A Lua file handle to read from."
},
{
"directive": "param",
"text": "[delta_which=both]\tstring\tIf the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state).",
"name": "[delta_which",
"type": "string",
"description": "If the schematic file is of type delta (i.e. as opposed to full), then this indicates which state is desired. Useful to significantly optimise both CPU and memory usage by avoiding parsing more than necessary if only one state is desired. Possible values: both (default; read both the previous and current states), prev (read only the previous state), current (read only the current state).",
"default_value": "both]"
}
],
"returns": {
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.file.weaschem.parse",
"filename": "worldeditadditions_core/utils/parse/file/weaschem.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/file/weaschem.lua#L223-L230"
}
parse_data_table 🔗
Parses a data table string into a Lua table.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source | string | nil | The source string to parse. |
is_delta | bool | nil | Whether the provided data table is of type delta or not. Used for validation. |
Returns
bool,string,table|string
:
- Success bool (
true
== success) - Error code. "SUCCESS" is passed if the operation was successful.
- Either the resulting Lua table if parsing was successful, or an error message as a string if not.
Source
--- Parses a data table string into a Lua table.
-- @internal
-- @param source string The source string to parse.
-- @param is_delta bool Whether the provided data table is of type delta or not. Used for validation.
-- @returns bool,string,table|string 1. Success bool (`true` == success)
-- 2. Error code. "SUCCESS" is passed if the operation was successful.
-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.
function weaschem.parse_data_table(source, is_delta)
{
"type": "function",
"internal": true,
"description": "Parses a data table string into a Lua table.",
"directives": [
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "source\t\tstring\tThe source string to parse.",
"name": "source",
"type": "string",
"description": "The source string to parse."
},
{
"directive": "param",
"text": "is_delta\tbool\tWhether the provided data table is of type delta or not. Used for validation.",
"name": "is_delta",
"type": "bool",
"description": "Whether the provided data table is of type delta or not. Used for validation."
},
{
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
}
],
"line": 159,
"namespace": "worldeditadditions_core.parse.file.weaschem",
"line_last": 166,
"name": "parse_data_table",
"instanced": false,
"args": [
"source",
"is_delta"
],
"text": "--- Parses a data table string into a Lua table.\n-- @internal\n-- @param\tsource\t\tstring\tThe source string to parse.\n-- @param\tis_delta\tbool\tWhether the provided data table is of type delta or not. Used for validation.\n-- @returns\tbool,string,table|string\t1. Success bool (`true` == success)\n-- 2. Error code. \"SUCCESS\" is passed if the operation was successful.\n-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.\nfunction weaschem.parse_data_table(source, is_delta)",
"params": [
{
"directive": "param",
"text": "source\t\tstring\tThe source string to parse.",
"name": "source",
"type": "string",
"description": "The source string to parse."
},
{
"directive": "param",
"text": "is_delta\tbool\tWhether the provided data table is of type delta or not. Used for validation.",
"name": "is_delta",
"type": "bool",
"description": "Whether the provided data table is of type delta or not. Used for validation."
}
],
"returns": {
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.file.weaschem.parse_data_table",
"filename": "worldeditadditions_core/utils/parse/file/weaschem.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/file/weaschem.lua#L160-L167"
}
parse_header 🔗
Parses the header out of the given source string.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source | string | nil | The source string to parse. |
Returns
bool,string,table|string
:
- Success bool (
true
== success) - Error code. "SUCCESS" is passed if the operation was successful.
- Either the resulting Lua table if parsing was successful, or an error message as a string if not.
Source
--- Parses the header out of the given source string.
-- @param source string The source string to parse.
-- @returns bool,string,table|string 1. Success bool (`true` == success)
-- 2. Error code. "SUCCESS" is passed if the operation was successful.
-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.
function weaschem.parse_header(source)
{
"type": "function",
"internal": false,
"description": "Parses the header out of the given source string.",
"directives": [
{
"directive": "param",
"text": "source\t\tstring\tThe source string to parse.",
"name": "source",
"type": "string",
"description": "The source string to parse."
},
{
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
}
],
"line": 48,
"namespace": "worldeditadditions_core.parse.file.weaschem",
"line_last": 53,
"name": "parse_header",
"instanced": false,
"args": [
"source"
],
"text": "--- Parses the header out of the given source string.\n-- @param\tsource\t\tstring\tThe source string to parse.\n-- @returns\tbool,string,table|string\t1. Success bool (`true` == success)\n-- 2. Error code. \"SUCCESS\" is passed if the operation was successful.\n-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.\nfunction weaschem.parse_header(source)",
"params": [
{
"directive": "param",
"text": "source\t\tstring\tThe source string to parse.",
"name": "source",
"type": "string",
"description": "The source string to parse."
}
],
"returns": {
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.file.weaschem.parse_header",
"filename": "worldeditadditions_core/utils/parse/file/weaschem.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/file/weaschem.lua#L49-L54"
}
parse_id_map 🔗
Parses the ID map out of the given source string.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source | string | nil | The source string to parse. |
Returns
bool,string,table|string
:
- Success bool (
true
== success) - Error code. "SUCCESS" is passed if the operation was successful.
- Either the resulting Lua table if parsing was successful, or an error message as a string if not.
Source
--- Parses the ID map out of the given source string.
-- @param source string The source string to parse.
-- @returns bool,string,table|string 1. Success bool (`true` == success)
-- 2. Error code. "SUCCESS" is passed if the operation was successful.
-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.
function weaschem.parse_id_map(source)
{
"type": "function",
"internal": false,
"description": "Parses the ID map out of the given source string.",
"directives": [
{
"directive": "param",
"text": "source\t\tstring\tThe source string to parse.",
"name": "source",
"type": "string",
"description": "The source string to parse."
},
{
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
}
],
"line": 124,
"namespace": "worldeditadditions_core.parse.file.weaschem",
"line_last": 129,
"name": "parse_id_map",
"instanced": false,
"args": [
"source"
],
"text": "--- Parses the ID map out of the given source string.\n-- @param\tsource\t\tstring\tThe source string to parse.\n-- @returns\tbool,string,table|string\t1. Success bool (`true` == success)\n-- 2. Error code. \"SUCCESS\" is passed if the operation was successful.\n-- 3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.\nfunction weaschem.parse_id_map(source)",
"params": [
{
"directive": "param",
"text": "source\t\tstring\tThe source string to parse.",
"name": "source",
"type": "string",
"description": "The source string to parse."
}
],
"returns": {
"directive": "returns",
"text": "bool,string,table|string\t1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not.",
"type": "bool,string,table|string",
"description": "1. Success bool (`true` == success)\n2. Error code. \"SUCCESS\" is passed if the operation was successful.\n3. Either the resulting Lua table if parsing was successful, or an error message as a string if not."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.file.weaschem.parse_id_map",
"filename": "worldeditadditions_core/utils/parse/file/weaschem.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/file/weaschem.lua#L125-L130"
}
parse_vector3 🔗
Validates and converts a raw table into a Vector3 instance.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source_obj | table | nil | The table to convert. |
Returns
bool,string,Vector3|string
:
A success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string.
Source
--- Validates and converts a raw table into a Vector3 instance.
-- @param source_obj table The table to convert.
-- @returns bool,string,Vector3|string A success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string.
function weaschem.parse_vector3(source_obj)
{
"type": "function",
"internal": false,
"description": "Validates and converts a raw table into a Vector3 instance.",
"directives": [
{
"directive": "param",
"text": "source_obj\ttable\tThe table to convert.",
"name": "source_obj",
"type": "table",
"description": "The table to convert."
},
{
"directive": "returns",
"text": "bool,string,Vector3|string\tA success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string.",
"type": "bool,string,Vector3|string",
"description": "A success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string."
}
],
"line": 24,
"namespace": "worldeditadditions_core.parse.file.weaschem",
"line_last": 27,
"name": "parse_vector3",
"instanced": false,
"args": [
"source_obj"
],
"text": "--- Validates and converts a raw table into a Vector3 instance.\n-- @param\tsource_obj\ttable\tThe table to convert.\n-- @returns\tbool,string,Vector3|string\tA success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string.\nfunction weaschem.parse_vector3(source_obj)",
"params": [
{
"directive": "param",
"text": "source_obj\ttable\tThe table to convert.",
"name": "source_obj",
"type": "table",
"description": "The table to convert."
}
],
"returns": {
"directive": "returns",
"text": "bool,string,Vector3|string\tA success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string.",
"type": "bool,string,Vector3|string",
"description": "A success bool, then an error code, then finally EITHER the resulting Vector3 instance (if bool=true) OR an error message as a string."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.file.weaschem.parse_vector3",
"filename": "worldeditadditions_core/utils/parse/file/weaschem.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/file/weaschem.lua#L25-L28"
}
Functions
parse_chance 🔗
Parses a chance value, and returns the 1-in-N value thereof.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | The string to parse. |
mode | string | nil | The operation mode. Valid modes: "1-in-n" (default), "weight". "1-in-n" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). "weight", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood). |
Returns
number|nil
:
The 1-in-N chance if parsing was successful, otherwise nil.
Source
--- Parses a chance value, and returns the 1-in-N value thereof.
-- @param str string The string to parse.
-- @param mode string The operation mode. Valid modes: "1-in-n" (default), "weight". "1-in-n" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). "weight", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood).
-- @returns number|nil The 1-in-N chance if parsing was successful, otherwise nil.
local function parse_chance(str, mode)
{
"type": "function",
"internal": false,
"description": "Parses a chance value, and returns the 1-in-N value thereof.",
"directives": [
{
"directive": "param",
"text": "str\t\tstring\tThe string to parse.",
"name": "str",
"type": "string",
"description": "The string to parse."
},
{
"directive": "param",
"text": "mode\tstring\tThe operation mode. Valid modes: \"1-in-n\" (default), \"weight\". \"1-in-n\" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). \"weight\", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood).",
"name": "mode",
"type": "string",
"description": "The operation mode. Valid modes: \"1-in-n\" (default), \"weight\". \"1-in-n\" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). \"weight\", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood)."
},
{
"directive": "returns",
"text": "number|nil\tThe 1-in-N chance if parsing was successful, otherwise nil.",
"type": "number|nil",
"description": "The 1-in-N chance if parsing was successful, otherwise nil."
}
],
"line": 5,
"namespace": "worldeditadditions_core.parse",
"line_last": 9,
"name": "parse_chance",
"instanced": false,
"args": [
"str",
"mode"
],
"text": "--- Parses a chance value, and returns the 1-in-N value thereof.\n-- @param\tstr\t\tstring\tThe string to parse.\n-- @param\tmode\tstring\tThe operation mode. Valid modes: \"1-in-n\" (default), \"weight\". \"1-in-n\" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). \"weight\", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood).\n-- @returns\tnumber|nil\tThe 1-in-N chance if parsing was successful, otherwise nil.\nlocal function parse_chance(str, mode)",
"params": [
{
"directive": "param",
"text": "str\t\tstring\tThe string to parse.",
"name": "str",
"type": "string",
"description": "The string to parse."
},
{
"directive": "param",
"text": "mode\tstring\tThe operation mode. Valid modes: \"1-in-n\" (default), \"weight\". \"1-in-n\" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). \"weight\", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood).",
"name": "mode",
"type": "string",
"description": "The operation mode. Valid modes: \"1-in-n\" (default), \"weight\". \"1-in-n\" refers to a 1-in-N chance of something happening (lower numbers mean greater likelihood). \"weight\", on the other hand, is instead a weighting that something will happen (higher numbers mean a greater likelihood)."
}
],
"returns": {
"directive": "returns",
"text": "number|nil\tThe 1-in-N chance if parsing was successful, otherwise nil.",
"type": "number|nil",
"description": "The 1-in-N chance if parsing was successful, otherwise nil."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.parse_chance",
"filename": "worldeditadditions_core/utils/parse/chance.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/chance.lua#L6-L10"
}
parse_map 🔗
Parses a map of key-value pairs into a table. For example, "count 25000 speed 0.8 rate_erosion 0.006 doawesome true" would be parsed into the following table: { count = 25000, speed = 0.8, rate_erosion = 0.006, doawesome = true }.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
params_text | string | nil | The string to parse. |
keywords | string[]? | nil | Optional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true. |
Returns
table
:
A table of key-value pairs parsed out from the given string.
Source
--- Parses a map of key-value pairs into a table.
-- For example, "count 25000 speed 0.8 rate_erosion 0.006 doawesome true" would be parsed into
-- the following table: { count = 25000, speed = 0.8, rate_erosion = 0.006, doawesome = true }.
-- @param params_text string The string to parse.
-- @param keywords string[]? Optional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true.
-- @returns table A table of key-value pairs parsed out from the given string.
local function parse_map(params_text, keywords)
{
"type": "function",
"internal": false,
"description": "Parses a map of key-value pairs into a table.\nFor example, \"count 25000 speed 0.8 rate_erosion 0.006 doawesome true\" would be parsed into\nthe following table: { count = 25000, speed = 0.8, rate_erosion = 0.006, doawesome = true }.",
"directives": [
{
"directive": "param",
"text": "params_text\tstring\t\tThe string to parse.",
"name": "params_text",
"type": "string",
"description": "The string to parse."
},
{
"directive": "param",
"text": "keywords\tstring[]?\tOptional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true.",
"name": "keywords",
"type": "string[]?",
"description": "Optional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true."
},
{
"directive": "returns",
"text": "table\t\tA table of key-value pairs parsed out from the given string.",
"type": "table",
"description": "A table of key-value pairs parsed out from the given string."
}
],
"line": 8,
"namespace": "worldeditadditions_core.parse",
"line_last": 14,
"name": "parse_map",
"instanced": false,
"args": [
"params_text",
"keywords"
],
"text": "--- Parses a map of key-value pairs into a table.\n-- For example, \"count 25000 speed 0.8 rate_erosion 0.006 doawesome true\" would be parsed into\n-- the following table: { count = 25000, speed = 0.8, rate_erosion = 0.006, doawesome = true }.\n-- @param\tparams_text\tstring\t\tThe string to parse.\n-- @param\tkeywords\tstring[]?\tOptional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true.\n-- @returns\ttable\t\tA table of key-value pairs parsed out from the given string.\nlocal function parse_map(params_text, keywords)",
"params": [
{
"directive": "param",
"text": "params_text\tstring\t\tThe string to parse.",
"name": "params_text",
"type": "string",
"description": "The string to parse."
},
{
"directive": "param",
"text": "keywords\tstring[]?\tOptional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true.",
"name": "keywords",
"type": "string[]?",
"description": "Optional. A list of keywords. Keywords can be present on their own without a value. If found, their value will be automatically set to bool true."
}
],
"returns": {
"directive": "returns",
"text": "table\t\tA table of key-value pairs parsed out from the given string.",
"type": "table",
"description": "A table of key-value pairs parsed out from the given string."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.parse_map",
"filename": "worldeditadditions_core/utils/parse/map.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/map.lua#L9-L15"
}
parse_seed 🔗
Makes a seed from a string. If the input is a number, it is returned as-is. If the input is a string and can be converted to a number with tonumber(), the output of tonumber() is returned. Otherwise, the string is converted to a number via a simple hashing algorithm (caution: certainlly NOT crypto-secure!).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
{string} str The string to convert. |
| nil |
Returns
nil
Source
--- Makes a seed from a string.
-- If the input is a number, it is returned as-is.
-- If the input is a string and can be converted to a number with tonumber(),
-- the output of tonumber() is returned.
-- Otherwise, the string is converted to a number via a simple hashing algorithm
-- (caution: certainlly NOT crypto-secure!).
-- @param {string} str The string to convert.
-- @source https://stackoverflow.com/a/2624210/1460422 The idea came from here
local function parse_seed(str)
{
"type": "function",
"internal": false,
"description": "Makes a seed from a string.\nIf the input is a number, it is returned as-is.\nIf the input is a string and can be converted to a number with tonumber(),\nthe output of tonumber() is returned.\nOtherwise, the string is converted to a number via a simple hashing algorithm\n(caution: certainlly NOT crypto-secure!).",
"directives": [
{
"directive": "param",
"text": "{string} str The string to convert.",
"name": "{string} str The string to convert."
},
{
"directive": "source",
"text": "https://stackoverflow.com/a/2624210/1460422 The idea came from here"
}
],
"line": 3,
"namespace": "worldeditadditions_core.parse",
"line_last": 11,
"name": "parse_seed",
"instanced": false,
"args": [
"str"
],
"text": "--- Makes a seed from a string.\n-- If the input is a number, it is returned as-is.\n-- If the input is a string and can be converted to a number with tonumber(),\n-- the output of tonumber() is returned.\n-- Otherwise, the string is converted to a number via a simple hashing algorithm\n-- (caution: certainlly NOT crypto-secure!).\n-- @param {string} str The string to convert.\n-- @source https://stackoverflow.com/a/2624210/1460422 The idea came from here\nlocal function parse_seed(str)",
"params": [
{
"directive": "param",
"text": "{string} str The string to convert.",
"name": "{string} str The string to convert."
}
],
"examples": [],
"name_full": "worldeditadditions_core.parse.parse_seed",
"filename": "worldeditadditions_core/utils/parse/seed.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/seed.lua#L4-L12"
}
parse_weighted_nodes 🔗
Parses a list of strings as a list of weighted nodes - e.g. like in the //mix command. Example: "dirt 5 stone sand 2".
Arguments
Name | Type | Default value | Description |
---|---|---|---|
parts | string[] | nil | The list of strings to parse (try worldeditadditions_core.split) |
as_list | bool | nil | If true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array. |
func_normalise | callable | nil | If specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name. |
Returns
table
:
A table in the form node_name => weight.
Source
--- Parses a list of strings as a list of weighted nodes - e.g. like in
-- the //mix command. Example: "dirt 5 stone sand 2".
-- @param parts string[] The list of strings to parse (try worldeditadditions_core.split)
-- @param as_list bool If true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array.
-- @param func_normalise callable If specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name.
-- @returns table A table in the form node_name => weight.
local function parse_weighted_nodes(parts, as_list, func_normalise)
{
"type": "function",
"internal": false,
"description": "Parses a list of strings as a list of weighted nodes - e.g. like in\nthe //mix command. Example: \"dirt 5 stone sand 2\".",
"directives": [
{
"directive": "param",
"text": "parts\tstring[]\tThe list of strings to parse (try worldeditadditions_core.split)",
"name": "parts",
"type": "string[]",
"description": "The list of strings to parse (try worldeditadditions_core.split)"
},
{
"directive": "param",
"text": "as_list\tbool\t\tIf true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array.",
"name": "as_list",
"type": "bool",
"description": "If true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array."
},
{
"directive": "param",
"text": "func_normalise\tcallable\tIf specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name.",
"name": "func_normalise",
"type": "callable",
"description": "If specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name."
},
{
"directive": "returns",
"text": "table\tA table in the form node_name => weight.",
"type": "table",
"description": "A table in the form node_name => weight."
}
],
"line": 6,
"namespace": "worldeditadditions_core.parse",
"line_last": 12,
"name": "parse_weighted_nodes",
"instanced": false,
"args": [
"parts",
"as_list",
"func_normalise"
],
"text": "--- Parses a list of strings as a list of weighted nodes - e.g. like in\n-- the //mix command. Example: \"dirt 5 stone sand 2\".\n-- @param\tparts\tstring[]\tThe list of strings to parse (try worldeditadditions_core.split)\n-- @param\tas_list\tbool\t\tIf true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array.\n-- @param\tfunc_normalise\tcallable\tIf specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name.\n-- @returns\ttable\tA table in the form node_name => weight.\nlocal function parse_weighted_nodes(parts, as_list, func_normalise)",
"params": [
{
"directive": "param",
"text": "parts\tstring[]\tThe list of strings to parse (try worldeditadditions_core.split)",
"name": "parts",
"type": "string[]",
"description": "The list of strings to parse (try worldeditadditions_core.split)"
},
{
"directive": "param",
"text": "as_list\tbool\t\tIf true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array.",
"name": "as_list",
"type": "bool",
"description": "If true, then table.insert() successive { node = string, weight = number } subtables when parsing instead of populating as an associative array."
},
{
"directive": "param",
"text": "func_normalise\tcallable\tIf specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name.",
"name": "func_normalise",
"type": "callable",
"description": "If specified, the given function will be used to normalise node names instead of worldedit.normalize_nodename. A single argument is passed containing the un-normalised node name, and the return value is assumed to be the normalised node name."
}
],
"returns": {
"directive": "returns",
"text": "table\tA table in the form node_name => weight.",
"type": "table",
"description": "A table in the form node_name => weight."
},
"examples": [],
"name_full": "worldeditadditions_core.parse.parse_weighted_nodes",
"filename": "worldeditadditions_core/utils/parse/weighted_nodes.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/weighted_nodes.lua#L7-L13"
}
parse.tokenise_commands 🔗
Tokenises a string of multiple commands into an array of individual commands. Preserves the forward slash at the beginning of each command name. Also supports arbitrarily nested and complex curly braces { } for grouping commands together that would normally be split apart.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
command_str | str | nil | The command string to operate on. |
Returns
bool,(string[]|string)
:
If the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead.
Examples
Simple example
INPUT: //1 //2 //outset 25 //fixlight
OUTPUT: { "//1", "//2", "//outset 25", "//fixlight" }
Example with curly braces
INPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}
OUTPUT: { "//1", "//2", "//outset 50", "//many 5 //multi //fixlight //clearcut"}
Source
--- Tokenises a string of multiple commands into an array of individual commands.
-- Preserves the forward slash at the beginning of each command name.
-- Also supports arbitrarily nested and complex curly braces { } for grouping
-- commands together that would normally be split apart.
--
-- @example Simple example
-- INPUT: //1 //2 //outset 25 //fixlight
-- OUTPUT: { "//1", "//2", "//outset 25", "//fixlight" }
--
-- @example Example with curly braces
-- INPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}
-- OUTPUT: { "//1", "//2", "//outset 50", "//many 5 //multi //fixlight //clearcut"}
--
-- @param command_str str The command string to operate on.
-- @returns bool,(string[]|string) If the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead.
function worldeditadditions_core.parse.tokenise_commands(command_str)
{
"type": "function",
"internal": false,
"description": "Tokenises a string of multiple commands into an array of individual commands.\nPreserves the forward slash at the beginning of each command name.\nAlso supports arbitrarily nested and complex curly braces { } for grouping\ncommands together that would normally be split apart.\n",
"directives": [
{
"directive": "example",
"text": "Simple example\nINPUT: //1 //2 //outset 25 //fixlight\nOUTPUT: { \"//1\", \"//2\", \"//outset 25\", \"//fixlight\" }",
"description": "Simple example",
"example": "INPUT: //1 //2 //outset 25 //fixlight\nOUTPUT: { \"//1\", \"//2\", \"//outset 25\", \"//fixlight\" }",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#80A665\">INPUT</span><span style=\"color:#DBD7CAEE\">: </span><span style=\"color:#CB7676\">//</span><span style=\"color:#4C9A91\">1</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#4C9A91\">2</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">outset</span><span style=\"color:#4C9A91\"> 25</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">fixlight</span></span>\n<span class=\"line\"><span style=\"color:#80A665\">OUTPUT</span><span style=\"color:#DBD7CAEE\">: { </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//1</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//2</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//outset 25</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//fixlight</span><span style=\"color:#C98A7D77\">\" </span><span style=\"color:#DBD7CAEE\">}</span></span></code></pre>"
},
{
"directive": "example",
"text": "Example with curly braces\nINPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}\nOUTPUT: { \"//1\", \"//2\", \"//outset 50\", \"//many 5 //multi //fixlight //clearcut\"}",
"description": "Example with curly braces",
"example": "INPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}\nOUTPUT: { \"//1\", \"//2\", \"//outset 50\", \"//many 5 //multi //fixlight //clearcut\"}",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#80A665\">INPUT</span><span style=\"color:#DBD7CAEE\">: </span><span style=\"color:#CB7676\">//</span><span style=\"color:#4C9A91\">1</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#4C9A91\">2</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">outset</span><span style=\"color:#4C9A91\"> 50</span><span style=\"color:#DBD7CAEE\"> {</span><span style=\"color:#CB7676\">//</span><span style=\"color:#BD976A\">many</span><span style=\"color:#4C9A91\"> 5</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">multi</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">fixlight</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">clearcut</span><span style=\"color:#DBD7CAEE\">}</span></span>\n<span class=\"line\"><span style=\"color:#80A665\">OUTPUT</span><span style=\"color:#DBD7CAEE\">: { </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//1</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//2</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//outset 50</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//many 5 //multi //fixlight //clearcut</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">}</span></span></code></pre>"
},
{
"directive": "param",
"text": "command_str\t\tstr\t\tThe command string to operate on.",
"name": "command_str",
"type": "str",
"description": "The command string to operate on."
},
{
"directive": "returns",
"text": "bool,(string[]|string)\tIf the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead.",
"type": "bool,(string[]|string)",
"description": "If the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead."
}
],
"line": 91,
"namespace": "worldeditadditions_core.parse",
"line_last": 106,
"name": "parse.tokenise_commands",
"instanced": false,
"args": [
"command_str"
],
"text": "--- Tokenises a string of multiple commands into an array of individual commands.\n-- Preserves the forward slash at the beginning of each command name.\n-- Also supports arbitrarily nested and complex curly braces { } for grouping\n-- commands together that would normally be split apart.\n-- \n-- @example Simple example\n-- INPUT: //1 //2 //outset 25 //fixlight\n-- OUTPUT: { \"//1\", \"//2\", \"//outset 25\", \"//fixlight\" }\n-- \n-- @example Example with curly braces\n-- INPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}\n-- OUTPUT: { \"//1\", \"//2\", \"//outset 50\", \"//many 5 //multi //fixlight //clearcut\"}\n-- \n-- @param\tcommand_str\t\tstr\t\tThe command string to operate on.\n-- @returns\tbool,(string[]|string)\tIf the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead.\nfunction worldeditadditions_core.parse.tokenise_commands(command_str)",
"params": [
{
"directive": "param",
"text": "command_str\t\tstr\t\tThe command string to operate on.",
"name": "command_str",
"type": "str",
"description": "The command string to operate on."
}
],
"returns": {
"directive": "returns",
"text": "bool,(string[]|string)\tIf the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead.",
"type": "bool,(string[]|string)",
"description": "If the operation was successful, then true followed by a table of strings is returned. If the operation was not successful, then false followed by an error message (as a single string) is returned instead."
},
"examples": [
{
"directive": "example",
"text": "Simple example\nINPUT: //1 //2 //outset 25 //fixlight\nOUTPUT: { \"//1\", \"//2\", \"//outset 25\", \"//fixlight\" }",
"description": "Simple example",
"example": "INPUT: //1 //2 //outset 25 //fixlight\nOUTPUT: { \"//1\", \"//2\", \"//outset 25\", \"//fixlight\" }",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#80A665\">INPUT</span><span style=\"color:#DBD7CAEE\">: </span><span style=\"color:#CB7676\">//</span><span style=\"color:#4C9A91\">1</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#4C9A91\">2</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">outset</span><span style=\"color:#4C9A91\"> 25</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">fixlight</span></span>\n<span class=\"line\"><span style=\"color:#80A665\">OUTPUT</span><span style=\"color:#DBD7CAEE\">: { </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//1</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//2</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//outset 25</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//fixlight</span><span style=\"color:#C98A7D77\">\" </span><span style=\"color:#DBD7CAEE\">}</span></span></code></pre>"
},
{
"directive": "example",
"text": "Example with curly braces\nINPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}\nOUTPUT: { \"//1\", \"//2\", \"//outset 50\", \"//many 5 //multi //fixlight //clearcut\"}",
"description": "Example with curly braces",
"example": "INPUT: //1 //2 //outset 50 {//many 5 //multi //fixlight //clearcut}\nOUTPUT: { \"//1\", \"//2\", \"//outset 50\", \"//many 5 //multi //fixlight //clearcut\"}",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#80A665\">INPUT</span><span style=\"color:#DBD7CAEE\">: </span><span style=\"color:#CB7676\">//</span><span style=\"color:#4C9A91\">1</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#4C9A91\">2</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">outset</span><span style=\"color:#4C9A91\"> 50</span><span style=\"color:#DBD7CAEE\"> {</span><span style=\"color:#CB7676\">//</span><span style=\"color:#BD976A\">many</span><span style=\"color:#4C9A91\"> 5</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">multi</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">fixlight</span><span style=\"color:#CB7676\"> //</span><span style=\"color:#BD976A\">clearcut</span><span style=\"color:#DBD7CAEE\">}</span></span>\n<span class=\"line\"><span style=\"color:#80A665\">OUTPUT</span><span style=\"color:#DBD7CAEE\">: { </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//1</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//2</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//outset 50</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">//many 5 //multi //fixlight //clearcut</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">}</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.parse.parse.tokenise_commands",
"filename": "worldeditadditions_core/utils/parse/tokenise_commands.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/tokenise_commands.lua#L92-L107"
}
recombine 🔗
Recombines a list of tokens into a list of commands.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
parts string[] The tokens from tokenise(str). |
| nil |
Returns
string[]
:
The tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)
Source
--- Recombines a list of tokens into a list of commands.
-- @param parts string[] The tokens from tokenise(str).
-- @returns string[] The tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)
local function recombine(parts)
{
"type": "function",
"internal": false,
"description": "Recombines a list of tokens into a list of commands.",
"directives": [
{
"directive": "param",
"text": "parts string[] The tokens from tokenise(str).",
"name": "parts string[] The tokens from tokenise(str)."
},
{
"directive": "returns",
"text": "string[]\tThe tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)",
"type": "string[]",
"description": "The tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)"
}
],
"line": 72,
"namespace": "worldeditadditions_core.parse",
"line_last": 75,
"name": "recombine",
"instanced": false,
"args": [
"parts"
],
"text": "--- Recombines a list of tokens into a list of commands.\n-- @param parts string[] The tokens from tokenise(str).\n-- @returns string[]\tThe tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)\nlocal function recombine(parts)",
"params": [
{
"directive": "param",
"text": "parts string[] The tokens from tokenise(str).",
"name": "parts string[] The tokens from tokenise(str)."
}
],
"returns": {
"directive": "returns",
"text": "string[]\tThe tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)",
"type": "string[]",
"description": "The tokens, but run through trim() & grouped into commands (1 element in the list = 1 command)"
},
"examples": [],
"name_full": "worldeditadditions_core.parse.recombine",
"filename": "worldeditadditions_core/utils/parse/tokenise_commands.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/tokenise_commands.lua#L73-L76"
}
tokenise 🔗
The main tokeniser. Splits the input string up into space separated tokens, except when said spaces are inside { curly braces }. Note that the outermost set of curly braces are stripped.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str string The input string to tokenise. |
| nil |
Returns
string[] A list of tokens
Source
--- The main tokeniser. Splits the input string up into space separated tokens, except when said spaces are inside { curly braces }.
-- Note that the outermost set of curly braces are stripped.
-- @param str string The input string to tokenise.
-- @returns string[] A list of tokens
local function tokenise(str)
{
"type": "function",
"internal": false,
"description": "The main tokeniser. Splits the input string up into space separated tokens, except when said spaces are inside { curly braces }.\nNote that the outermost set of curly braces are stripped.",
"directives": [
{
"directive": "param",
"text": "str string The input string to tokenise.",
"name": "str string The input string to tokenise."
},
{
"directive": "returns",
"text": "string[] A list of tokens",
"type": "string[] A list of tokens"
}
],
"line": 9,
"namespace": "worldeditadditions_core.parse",
"line_last": 13,
"name": "tokenise",
"instanced": false,
"args": [
"str"
],
"text": "--- The main tokeniser. Splits the input string up into space separated tokens, except when said spaces are inside { curly braces }.\n-- Note that the outermost set of curly braces are stripped.\n-- @param str string The input string to tokenise.\n-- @returns string[] A list of tokens\nlocal function tokenise(str)",
"params": [
{
"directive": "param",
"text": "str string The input string to tokenise.",
"name": "str string The input string to tokenise."
}
],
"returns": {
"directive": "returns",
"text": "string[] A list of tokens",
"type": "string[] A list of tokens"
},
"examples": [],
"name_full": "worldeditadditions_core.parse.tokenise",
"filename": "worldeditadditions_core/utils/parse/tokenise_commands.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/parse/tokenise_commands.lua#L10-L14"
}
Path 🔗
A path manipulation class.
Functions
🔗
Format string into path
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | The string to process |
Returns
string|false, string?
:
The formatted path string or
Examples
Basic usage
local path = path.norm("C:\\Users\\me\\".."/Documents//code.lua")
Source
--- Format string into path
-- @param str string The string to process
-- @return string|false, string? The formatted path string or
-- false and an error message.
-- @example Basic usage
-- local path = path.norm("C:\\Users\\me\\".."/Documents//code.lua")
path.norm = function( str )
{
"type": "function",
"internal": false,
"description": "Format string into path",
"directives": [
{
"directive": "param",
"text": "str\tstring\tThe string to process",
"name": "str",
"type": "string",
"description": "The string to process"
},
{
"directive": "returns",
"text": "string|false, string?\tThe formatted path string or\n\t\t\tfalse and an error message.",
"type": "string|false, string?",
"description": "The formatted path string or\n"
},
{
"directive": "example",
"text": "Basic usage\n\tlocal path = path.norm(\"C:\\\\Users\\\\me\\\\\"..\"/Documents//code.lua\")",
"description": "Basic usage",
"example": "\tlocal path = path.norm(\"C:\\\\Users\\\\me\\\\\"..\"/Documents//code.lua\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">\tlocal</span><span style=\"color:#BD976A\"> path</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#BD976A\"> path</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">norm</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">C:</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D\">Users</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D\">me</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#CB7676\">..</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">/Documents//code.lua</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"line": 21,
"namespace": "worldeditadditions_core.Path",
"line_last": 27,
"text": "--- Format string into path\n--\t@param\tstr\tstring\tThe string to process\n--\t@return\t\tstring|false, string?\tThe formatted path string or\n--\t\t\t\tfalse and an error message.\n--\t@example\tBasic usage\n--\t\tlocal path = path.norm(\"C:\\\\Users\\\\me\\\\\"..\"/Documents//code.lua\")\npath.norm = function( str )",
"params": [
{
"directive": "param",
"text": "str\tstring\tThe string to process",
"name": "str",
"type": "string",
"description": "The string to process"
}
],
"returns": {
"directive": "returns",
"text": "string|false, string?\tThe formatted path string or\n\t\t\tfalse and an error message.",
"type": "string|false, string?",
"description": "The formatted path string or\n"
},
"examples": [
{
"directive": "example",
"text": "Basic usage\n\tlocal path = path.norm(\"C:\\\\Users\\\\me\\\\\"..\"/Documents//code.lua\")",
"description": "Basic usage",
"example": "\tlocal path = path.norm(\"C:\\\\Users\\\\me\\\\\"..\"/Documents//code.lua\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">\tlocal</span><span style=\"color:#BD976A\"> path</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#BD976A\"> path</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">norm</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">C:</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D\">Users</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D\">me</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#CB7676\">..</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">/Documents//code.lua</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.Path.undefined",
"filename": "worldeditadditions_core/utils/path.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/path.lua#L22-L28"
}
🔗
Joins the given path segments into a single path with dirsep.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
... | string | nil | The path fragments to process and join. |
Returns
string|false, string?
:
The joined path or
Examples
Basic usage
local path = file_path("C:\\Users", "me", "/Documents/code.lua")
Source
--- Joins the given path segments into a single path with dirsep.
-- @param ... string The path fragments to process and join.
-- @return string|false, string? The joined path or
-- false and an error message.
-- @example Basic usage
-- local path = file_path("C:\\Users", "me", "/Documents/code.lua")
path.join = function( ... )
{
"type": "function",
"internal": false,
"description": "Joins the given path segments into a single path with dirsep.",
"directives": [
{
"directive": "param",
"text": "...\tstring\tThe path fragments to process and join.",
"name": "...",
"type": "string",
"description": "The path fragments to process and join."
},
{
"directive": "returns",
"text": "string|false, string?\tThe joined path or\n\t\t\tfalse and an error message.",
"type": "string|false, string?",
"description": "The joined path or\n"
},
{
"directive": "example",
"text": "Basic usage\n\tlocal path = file_path(\"C:\\\\Users\", \"me\", \"/Documents/code.lua\")",
"description": "Basic usage",
"example": "\tlocal path = file_path(\"C:\\\\Users\", \"me\", \"/Documents/code.lua\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">\tlocal</span><span style=\"color:#BD976A\"> path</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#B8A965\"> file_path</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">C:</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D\">Users</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">me</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">/Documents/code.lua</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"line": 33,
"namespace": "worldeditadditions_core.Path",
"line_last": 39,
"text": "--- Joins the given path segments into a single path with dirsep.\n--\t@param\t...\tstring\tThe path fragments to process and join.\n--\t@return\t\tstring|false, string?\tThe joined path or\n--\t\t\t\tfalse and an error message.\n--\t@example\tBasic usage\n--\t\tlocal path = file_path(\"C:\\\\Users\", \"me\", \"/Documents/code.lua\")\npath.join = function( ... )",
"params": [
{
"directive": "param",
"text": "...\tstring\tThe path fragments to process and join.",
"name": "...",
"type": "string",
"description": "The path fragments to process and join."
}
],
"returns": {
"directive": "returns",
"text": "string|false, string?\tThe joined path or\n\t\t\tfalse and an error message.",
"type": "string|false, string?",
"description": "The joined path or\n"
},
"examples": [
{
"directive": "example",
"text": "Basic usage\n\tlocal path = file_path(\"C:\\\\Users\", \"me\", \"/Documents/code.lua\")",
"description": "Basic usage",
"example": "\tlocal path = file_path(\"C:\\\\Users\", \"me\", \"/Documents/code.lua\")",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">\tlocal</span><span style=\"color:#BD976A\"> path</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#B8A965\"> file_path</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">C:</span><span style=\"color:#C99076\">\\\\</span><span style=\"color:#C98A7D\">Users</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">me</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#C98A7D\">/Documents/code.lua</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">)</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.Path.undefined",
"filename": "worldeditadditions_core/utils/path.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/path.lua#L34-L40"
}
pos 🔗
Position manager.
Functions
clear 🔗
Clears all the positions for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to clear the positions for. |
Returns
void
Source
--- Clears all the positions for the given player.
-- @param player_name string The name of the player to clear the positions for.
-- @returns void
local function clear(player_name)
{
"type": "function",
"internal": false,
"description": "Clears all the positions for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to clear the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to clear the positions for."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 246,
"namespace": "worldeditadditions_core.pos",
"line_last": 249,
"name": "clear",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Clears all the positions for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to clear the positions for.\n-- @returns\tvoid\nlocal function clear(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to clear the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to clear the positions for."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions_core.pos.clear",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L247-L250"
}
compat_worldedit_get 🔗
Fetches pos1/pos2 from WorldEdit (if available) and sets them in WorldEditAdditions' postional subsystem
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to sync the positions for. |
Returns
nil
Source
--- Fetches pos1/pos2 from WorldEdit (if available) and sets them in WorldEditAdditions' postional subsystem
-- @param player_name string The name of the player to sync the positions for.
local function compat_worldedit_get(player_name)
{
"type": "function",
"internal": false,
"description": "Fetches pos1/pos2 from WorldEdit (if available) and sets them in WorldEditAdditions' postional subsystem",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to sync the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to sync the positions for."
}
],
"line": 107,
"namespace": "worldeditadditions_core.pos",
"line_last": 109,
"name": "compat_worldedit_get",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Fetches pos1/pos2 from WorldEdit (if available) and sets them in WorldEditAdditions' postional subsystem\n-- @param\tplayer_name\t\tstring\tThe name of the player to sync the positions for.\nlocal function compat_worldedit_get(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to sync the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to sync the positions for."
}
],
"examples": [],
"name_full": "worldeditadditions_core.pos.compat_worldedit_get",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L108-L110"
}
compat_worldedit_pos1_get 🔗
Transparently fetches from worldedit pos1 for compatibility. Called whenever pos1 is accessed in this API.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
Returns
void
Source
--- Transparently fetches from worldedit pos1 for compatibility.
-- Called whenever pos1 is accessed in this API.
-- @internal
-- @param player_name string The name of the player to fetch the position for.
-- @returns void
local function compat_worldedit_pos1_get(player_name)
{
"type": "function",
"internal": true,
"description": "Transparently fetches from worldedit pos1 for compatibility.\nCalled whenever pos1 is accessed in this API.",
"directives": [
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 52,
"namespace": "worldeditadditions_core.pos",
"line_last": 57,
"name": "compat_worldedit_pos1_get",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Transparently fetches from worldedit pos1 for compatibility.\n-- Called whenever pos1 is accessed in this API.\n-- @internal\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @returns\tvoid\nlocal function compat_worldedit_pos1_get(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions_core.pos.compat_worldedit_pos1_get",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L53-L58"
}
compat_worldedit_pos2_get 🔗
Transparently fetches from worldedit pos2 for compatibility. Called whenever pos2 is accessed in this API.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
Returns
void
Source
--- Transparently fetches from worldedit pos2 for compatibility.
-- Called whenever pos2 is accessed in this API.
-- @internal
-- @param player_name string The name of the player to fetch the position for.
-- @returns void
local function compat_worldedit_pos2_get(player_name)
{
"type": "function",
"internal": true,
"description": "Transparently fetches from worldedit pos2 for compatibility.\nCalled whenever pos2 is accessed in this API.",
"directives": [
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 68,
"namespace": "worldeditadditions_core.pos",
"line_last": 73,
"name": "compat_worldedit_pos2_get",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Transparently fetches from worldedit pos2 for compatibility.\n-- Called whenever pos2 is accessed in this API.\n-- @internal\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @returns\tvoid\nlocal function compat_worldedit_pos2_get(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions_core.pos.compat_worldedit_pos2_get",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L69-L74"
}
compat_worldedit_set 🔗
Sets pos1/pos2 in worldedit for compatibility.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to set the position for. |
i | number | nil | The index of the position to set. |
pos | Vector3 | nil | The position to set. |
do_update | bool | true | Whether to call worldedit.marker_update() or not. |
Returns
nil
Source
--- Sets pos1/pos2 in worldedit for compatibility.
-- @param player_name string The name of the player to set the position for.
-- @param i number The index of the position to set.
-- @param pos Vector3 The position to set.
-- @param do_update=true bool Whether to call worldedit.marker_update() or not.
-- @returns nil
local function compat_worldedit_set(player_name, i, pos, do_update)
{
"type": "function",
"internal": false,
"description": "Sets pos1/pos2 in worldedit for compatibility.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to set the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the position for."
},
{
"directive": "param",
"text": "i\t\t\t\tnumber\tThe index of the position to set.",
"name": "i",
"type": "number",
"description": "The index of the position to set."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3\tThe position to set.",
"name": "pos",
"type": "Vector3",
"description": "The position to set."
},
{
"directive": "param",
"text": "do_update=true\tbool\tWhether to call worldedit.marker_update() or not.",
"name": "do_update",
"type": "bool",
"description": "Whether to call worldedit.marker_update() or not.",
"default_value": "true"
},
{
"directive": "returns",
"text": "nil",
"type": "nil"
}
],
"line": 85,
"namespace": "worldeditadditions_core.pos",
"line_last": 91,
"name": "compat_worldedit_set",
"instanced": false,
"args": [
"player_name",
"i",
"pos",
"do_update"
],
"text": "--- Sets pos1/pos2 in worldedit for compatibility.\n-- @param\tplayer_name\t\tstring\tThe name of the player to set the position for.\n-- @param\ti\t\t\t\tnumber\tThe index of the position to set.\n-- @param\tpos\t\t\t\tVector3\tThe position to set.\n-- @param\tdo_update=true\tbool\tWhether to call worldedit.marker_update() or not.\n-- @returns\tnil\nlocal function compat_worldedit_set(player_name, i, pos, do_update)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to set the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the position for."
},
{
"directive": "param",
"text": "i\t\t\t\tnumber\tThe index of the position to set.",
"name": "i",
"type": "number",
"description": "The index of the position to set."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3\tThe position to set.",
"name": "pos",
"type": "Vector3",
"description": "The position to set."
},
{
"directive": "param",
"text": "do_update=true\tbool\tWhether to call worldedit.marker_update() or not.",
"name": "do_update",
"type": "bool",
"description": "Whether to call worldedit.marker_update() or not.",
"default_value": "true"
}
],
"returns": {
"directive": "returns",
"text": "nil",
"type": "nil"
},
"examples": [],
"name_full": "worldeditadditions_core.pos.compat_worldedit_set",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L86-L92"
}
count 🔗
Counts the number of positioons registered to a given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
Returns
number
:
The number of positions registered for the given player.
Source
--- Counts the number of positioons registered to a given player.
-- @param player_name string The name of the player to fetch the position for.
-- @returns number The number of positions registered for the given player.
local function count(player_name)
{
"type": "function",
"internal": false,
"description": "Counts the number of positioons registered to a given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "returns",
"text": "number\t\t\tThe number of positions registered for the given player.",
"type": "number",
"description": "The number of positions registered for the given player."
}
],
"line": 177,
"namespace": "worldeditadditions_core.pos",
"line_last": 180,
"name": "count",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Counts the number of positioons registered to a given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @returns\tnumber\t\t\tThe number of positions registered for the given player.\nlocal function count(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
}
],
"returns": {
"directive": "returns",
"text": "number\t\t\tThe number of positions registered for the given player.",
"type": "number",
"description": "The number of positions registered for the given player."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.count",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L178-L181"
}
ensure_player 🔗
Ensures that a table exists for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to check. |
Returns
nil
Source
--- Ensures that a table exists for the given player.
-- @param player_name string The name of the player to check.
local function ensure_player(player_name)
{
"type": "function",
"internal": false,
"description": "Ensures that a table exists for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to check.",
"name": "player_name",
"type": "string",
"description": "The name of the player to check."
}
],
"line": 41,
"namespace": "worldeditadditions_core.pos",
"line_last": 43,
"name": "ensure_player",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Ensures that a table exists for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to check.\nlocal function ensure_player(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to check.",
"name": "player_name",
"type": "string",
"description": "The name of the player to check."
}
],
"examples": [],
"name_full": "worldeditadditions_core.pos.ensure_player",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L42-L44"
}
get 🔗
Gets the position with the given index for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
i | number | nil | The index of the position to fetch. |
Returns
Vector3?
:
The position requested, or nil if it doesn't exist.
Source
--- Gets the position with the given index for the given player.
-- @param player_name string The name of the player to fetch the position for.
-- @param i number The index of the position to fetch.
-- @returns Vector3? The position requested, or nil if it doesn't exist.
local function get(player_name, i)
{
"type": "function",
"internal": false,
"description": "Gets the position with the given index for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "param",
"text": "i\t\t\t\tnumber\tThe index of the position to fetch.",
"name": "i",
"type": "number",
"description": "The index of the position to fetch."
},
{
"directive": "returns",
"text": "Vector3?\t\tThe position requested, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position requested, or nil if it doesn't exist."
}
],
"line": 114,
"namespace": "worldeditadditions_core.pos",
"line_last": 118,
"name": "get",
"instanced": false,
"args": [
"player_name",
"i"
],
"text": "--- Gets the position with the given index for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @param\ti\t\t\t\tnumber\tThe index of the position to fetch.\n-- @returns\tVector3?\t\tThe position requested, or nil if it doesn't exist.\nlocal function get(player_name, i)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "param",
"text": "i\t\t\t\tnumber\tThe index of the position to fetch.",
"name": "i",
"type": "number",
"description": "The index of the position to fetch."
}
],
"returns": {
"directive": "returns",
"text": "Vector3?\t\tThe position requested, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position requested, or nil if it doesn't exist."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.get",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L115-L119"
}
get_all 🔗
Gets a list of all the positions for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
Returns
Vector3[]
:
A list of positions for the given player.
Source
--- Gets a list of all the positions for the given player.
-- @param player_name string The name of the player to fetch the position for.
-- @returns Vector3[] A list of positions for the given player.
local function get_all(player_name)
{
"type": "function",
"internal": false,
"description": "Gets a list of all the positions for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "returns",
"text": "Vector3[]\t\tA list of positions for the given player.",
"type": "Vector3[]",
"description": "A list of positions for the given player."
}
],
"line": 148,
"namespace": "worldeditadditions_core.pos",
"line_last": 151,
"name": "get_all",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Gets a list of all the positions for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @returns\tVector3[]\t\tA list of positions for the given player.\nlocal function get_all(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
}
],
"returns": {
"directive": "returns",
"text": "Vector3[]\t\tA list of positions for the given player.",
"type": "Vector3[]",
"description": "A list of positions for the given player."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.get_all",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L149-L152"
}
get_bounds 🔗
Get a bounding box that encloses all the positions currently defined by a given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the boudnign box for. |
Returns
nil|(Vector3,Vector3)
:
2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined.
Source
--- Get a bounding box that encloses all the positions currently defined by a given player.
-- @param player_name string The name of the player to fetch the boudnign box for.
-- @returns nil|(Vector3,Vector3) 2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined.
local function get_bounds(player_name)
{
"type": "function",
"internal": false,
"description": "Get a bounding box that encloses all the positions currently defined by a given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the boudnign box for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the boudnign box for."
},
{
"directive": "returns",
"text": "nil|(Vector3,Vector3)\t2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined.",
"type": "nil|(Vector3,Vector3)",
"description": "2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined."
}
],
"line": 159,
"namespace": "worldeditadditions_core.pos",
"line_last": 162,
"name": "get_bounds",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Get a bounding box that encloses all the positions currently defined by a given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the boudnign box for.\n-- @returns nil|(Vector3,Vector3)\t2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined.\nlocal function get_bounds(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the boudnign box for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the boudnign box for."
}
],
"returns": {
"directive": "returns",
"text": "nil|(Vector3,Vector3)\t2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined.",
"type": "nil|(Vector3,Vector3)",
"description": "2 positions that define opposite corners of a region that fully encloses all the defined points for the given player, or nil ir the specified player has no points currently defined."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.get_bounds",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L160-L163"
}
get1 🔗
Convenience function that returns position 1 for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
Returns
Vector3?
:
The position requested, or nil if it doesn't exist.
Source
--- Convenience function that returns position 1 for the given player.
-- @param player_name string The name of the player to fetch the position for.
-- @returns Vector3? The position requested, or nil if it doesn't exist.
local function get1(player_name) return get(player_name, 1) end
{
"type": "function",
"internal": false,
"description": "Convenience function that returns position 1 for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "returns",
"text": "Vector3?\t\tThe position requested, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position requested, or nil if it doesn't exist."
}
],
"line": 126,
"namespace": "worldeditadditions_core.pos",
"line_last": 129,
"name": "get1",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Convenience function that returns position 1 for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @returns\tVector3?\t\tThe position requested, or nil if it doesn't exist.\nlocal function get1(player_name) return get(player_name, 1) end",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
}
],
"returns": {
"directive": "returns",
"text": "Vector3?\t\tThe position requested, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position requested, or nil if it doesn't exist."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.get1",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L127-L130"
}
get12 🔗
Convenience function that returns pos1 and pos2 with the coordinates sorted for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
sort | bool | false | If true, the pos1 and pos2 are run through Vector3.sort() automatically. |
Returns
Vector3?,Vector3
:
The positions requested, or nil if either of them don't exist.
Source
--- Convenience function that returns pos1 and pos2 with the coordinates sorted for the given player.
-- @param player_name string The name of the player to fetch the position for.
-- @param sort=false bool If true, the pos1 and pos2 are run through Vector3.sort() automatically.
-- @returns Vector3?,Vector3 The positions requested, or nil if either of them don't exist.
local function get12(player_name, sort)
{
"type": "function",
"internal": false,
"description": "Convenience function that returns pos1 and pos2 with the coordinates sorted for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "param",
"text": "sort=false\t\t\tbool\tIf true, the pos1 and pos2 are run through Vector3.sort() automatically.",
"name": "sort",
"type": "bool",
"description": "If true, the pos1 and pos2 are run through Vector3.sort() automatically.",
"default_value": "false"
},
{
"directive": "returns",
"text": "Vector3?,Vector3\t\tThe positions requested, or nil if either of them don't exist.",
"type": "Vector3?,Vector3",
"description": "The positions requested, or nil if either of them don't exist."
}
],
"line": 135,
"namespace": "worldeditadditions_core.pos",
"line_last": 139,
"name": "get12",
"instanced": false,
"args": [
"player_name",
"sort"
],
"text": "--- Convenience function that returns pos1 and pos2 with the coordinates sorted for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @param\tsort=false\t\t\tbool\tIf true, the pos1 and pos2 are run through Vector3.sort() automatically.\n-- @returns\tVector3?,Vector3\t\tThe positions requested, or nil if either of them don't exist.\nlocal function get12(player_name, sort)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "param",
"text": "sort=false\t\t\tbool\tIf true, the pos1 and pos2 are run through Vector3.sort() automatically.",
"name": "sort",
"type": "bool",
"description": "If true, the pos1 and pos2 are run through Vector3.sort() automatically.",
"default_value": "false"
}
],
"returns": {
"directive": "returns",
"text": "Vector3?,Vector3\t\tThe positions requested, or nil if either of them don't exist.",
"type": "Vector3?,Vector3",
"description": "The positions requested, or nil if either of them don't exist."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.get12",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L136-L140"
}
get2 🔗
Convenience function that returns position 1 for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to fetch the position for. |
Returns
Vector3?
:
The position requested, or nil if it doesn't exist.
Source
--- Convenience function that returns position 1 for the given player.
-- @param player_name string The name of the player to fetch the position for.
-- @returns Vector3? The position requested, or nil if it doesn't exist.
local function get2(player_name) return get(player_name, 2) end
{
"type": "function",
"internal": false,
"description": "Convenience function that returns position 1 for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
},
{
"directive": "returns",
"text": "Vector3?\t\tThe position requested, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position requested, or nil if it doesn't exist."
}
],
"line": 130,
"namespace": "worldeditadditions_core.pos",
"line_last": 133,
"name": "get2",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Convenience function that returns position 1 for the given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to fetch the position for.\n-- @returns\tVector3?\t\tThe position requested, or nil if it doesn't exist.\nlocal function get2(player_name) return get(player_name, 2) end",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to fetch the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to fetch the position for."
}
],
"returns": {
"directive": "returns",
"text": "Vector3?\t\tThe position requested, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position requested, or nil if it doesn't exist."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.get2",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L131-L134"
}
mark 🔗
Shows the visual markers for the given player's positions and defined region once more. Often used some time after calling worldeditadditions_core.pos.unmark().
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to operate on. |
Returns
void
Source
--- Shows the visual markers for the given player's positions and defined region once more.
-- Often used some time after calling worldeditadditions_core.pos.unmark().
-- @param player_name string The name of the player to operate on.
-- @returns void
local function mark(player_name)
{
"type": "function",
"internal": false,
"description": "Shows the visual markers for the given player's positions and defined region once more.\nOften used some time after calling worldeditadditions_core.pos.unmark().",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to operate on.",
"name": "player_name",
"type": "string",
"description": "The name of the player to operate on."
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 308,
"namespace": "worldeditadditions_core.pos",
"line_last": 312,
"name": "mark",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Shows the visual markers for the given player's positions and defined region once more.\n-- Often used some time after calling worldeditadditions_core.pos.unmark().\n-- @param\tplayer_name\t\tstring\tThe name of the player to operate on.\n-- @returns\tvoid\nlocal function mark(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to operate on.",
"name": "player_name",
"type": "string",
"description": "The name of the player to operate on."
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions_core.pos.mark",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L309-L313"
}
pop 🔗
Removes the last position from the for a given player and returns it.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to pop the position for. |
Returns
Vector3?
:
The position removed, or nil if it doesn't exist.
Source
--- Removes the last position from the for a given player and returns it.
-- @param player_name string The name of the player to pop the position for.
-- @returns Vector3? The position removed, or nil if it doesn't exist.
local function pop(player_name)
{
"type": "function",
"internal": false,
"description": "Removes the last position from the for a given player and returns it.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to pop the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to pop the position for."
},
{
"directive": "returns",
"text": "Vector3?\t\tThe position removed, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position removed, or nil if it doesn't exist."
}
],
"line": 260,
"namespace": "worldeditadditions_core.pos",
"line_last": 263,
"name": "pop",
"instanced": false,
"args": [
"player_name"
],
"text": "--- Removes the last position from the for a given player and returns it.\n-- @param\tplayer_name\t\tstring\tThe name of the player to pop the position for.\n-- @returns\tVector3?\t\tThe position removed, or nil if it doesn't exist.\nlocal function pop(player_name)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to pop the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to pop the position for."
}
],
"returns": {
"directive": "returns",
"text": "Vector3?\t\tThe position removed, or nil if it doesn't exist.",
"type": "Vector3?",
"description": "The position removed, or nil if it doesn't exist."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.pop",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L261-L264"
}
push 🔗
Adds a position to the list for a given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to add the position for. |
pos | Vector3 | nil | The position to add. |
Returns
number
:
The new number of positions for that player.
Source
--- Adds a position to the list for a given player.
-- @param player_name string The name of the player to add the position for.
-- @param pos Vector3 The position to add.
-- @returns number The new number of positions for that player.
local function push(player_name, pos)
{
"type": "function",
"internal": false,
"description": "Adds a position to the list for a given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to add the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to add the position for."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3\tThe position to add.",
"name": "pos",
"type": "Vector3",
"description": "The position to add."
},
{
"directive": "returns",
"text": "number\t\t\tThe new number of positions for that player.",
"type": "number",
"description": "The new number of positions for that player."
}
],
"line": 279,
"namespace": "worldeditadditions_core.pos",
"line_last": 283,
"name": "push",
"instanced": false,
"args": [
"player_name",
"pos"
],
"text": "--- Adds a position to the list for a given player.\n-- @param\tplayer_name\t\tstring\tThe name of the player to add the position for.\n-- @param\tpos\t\t\t\tVector3\tThe position to add.\n-- @returns\tnumber\t\t\tThe new number of positions for that player.\nlocal function push(player_name, pos)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to add the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to add the position for."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3\tThe position to add.",
"name": "pos",
"type": "Vector3",
"description": "The position to add."
}
],
"returns": {
"directive": "returns",
"text": "number\t\t\tThe new number of positions for that player.",
"type": "number",
"description": "The new number of positions for that player."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.push",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L280-L284"
}
set 🔗
Sets the position at the given index for the given player. You probably want push_pos, not this function.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to set the position for. |
i | number | nil | The index to set the position at. |
pos | Vector3 | nil | The position to set. |
Returns
bool
:
Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).
Source
--- Sets the position at the given index for the given player.
-- You probably want push_pos, not this function.
-- @param player_name string The name of the player to set the position for.
-- @param i number The index to set the position at.
-- @param pos Vector3 The position to set.
-- @returns bool Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).
local function set(player_name, i, pos)
{
"type": "function",
"internal": false,
"description": "Sets the position at the given index for the given player.\nYou probably want push_pos, not this function.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to set the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the position for."
},
{
"directive": "param",
"text": "i\t\t\t\tnumber\tThe index to set the position at.",
"name": "i",
"type": "number",
"description": "The index to set the position at."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3\tThe position to set.",
"name": "pos",
"type": "Vector3",
"description": "The position to set."
},
{
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).",
"type": "bool",
"description": "Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time)."
}
],
"line": 187,
"namespace": "worldeditadditions_core.pos",
"line_last": 193,
"name": "set",
"instanced": false,
"args": [
"player_name",
"i",
"pos"
],
"text": "--- Sets the position at the given index for the given player.\n-- You probably want push_pos, not this function.\n-- @param\tplayer_name\t\tstring\tThe name of the player to set the position for.\n-- @param\ti\t\t\t\tnumber\tThe index to set the position at.\n-- @param\tpos\t\t\t\tVector3\tThe position to set.\n-- @returns\tbool\t\t\tWhether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).\nlocal function set(player_name, i, pos)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to set the position for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the position for."
},
{
"directive": "param",
"text": "i\t\t\t\tnumber\tThe index to set the position at.",
"name": "i",
"type": "number",
"description": "The index to set the position at."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3\tThe position to set.",
"name": "pos",
"type": "Vector3",
"description": "The position to set."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).",
"type": "bool",
"description": "Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time)."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.set",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L188-L194"
}
set_all 🔗
Sets the all the positions for the given player. You probably want push_pos, not this function.
WARNING: Will DELETE all points registered for the given player!
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to set the positions for. |
pos_list | Vector3 | nil | The table of positions to set. |
Returns
bool
:
Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).
Source
--- Sets the all the positions for the given player.
-- You probably want push_pos, not this function.
--
-- WARNING: Will DELETE all points registered for the given player!
--
-- @param player_name string The name of the player to set the positions for.
-- @param pos_list Vector3 The table of positions to set.
-- @returns bool Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).
local function set_all(player_name, pos_list)
{
"type": "function",
"internal": false,
"description": "Sets the all the positions for the given player.\nYou probably want push_pos, not this function.\n\nWARNING: Will DELETE all points registered for the given player!\n",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to set the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the positions for."
},
{
"directive": "param",
"text": "pos_list\t\tVector3\tThe table of positions to set.",
"name": "pos_list",
"type": "Vector3",
"description": "The table of positions to set."
},
{
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).",
"type": "bool",
"description": "Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time)."
}
],
"line": 229,
"namespace": "worldeditadditions_core.pos",
"line_last": 237,
"name": "set_all",
"instanced": false,
"args": [
"player_name",
"pos_list"
],
"text": "--- Sets the all the positions for the given player.\n-- You probably want push_pos, not this function.\n-- \n-- WARNING: Will DELETE all points registered for the given player!\n-- \n-- @param\tplayer_name\t\tstring\tThe name of the player to set the positions for.\n-- @param\tpos_list\t\tVector3\tThe table of positions to set.\n-- @returns\tbool\t\t\tWhether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).\nlocal function set_all(player_name, pos_list)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to set the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the positions for."
},
{
"directive": "param",
"text": "pos_list\t\tVector3\tThe table of positions to set.",
"name": "pos_list",
"type": "Vector3",
"description": "The table of positions to set."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).",
"type": "bool",
"description": "Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time)."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.set_all",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L230-L238"
}
set_multi 🔗
Sets multiple positions for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to set the positions for. |
pos_list | table<int, Vector3> | nil | A table of Vector3 positions to set, where the key is the index and the value is the position. |
Returns
nil
Source
--- Sets multiple positions for the given player.
-- @param player_name string The name of the player to set the positions for.
-- @param pos_list table<int, Vector3> A table of Vector3 positions to set, where the key is the index and the value is the position.
local function set_multi(player_name, pos_list)
{
"type": "function",
"internal": false,
"description": "Sets multiple positions for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\t\t\t\tThe name of the player to set the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the positions for."
},
{
"directive": "param",
"text": "pos_list\t\ttable<int, Vector3>\tA table of Vector3 positions to set, where the key is the index and the value is the position.",
"name": "pos_list",
"type": "table<int, Vector3>",
"description": "A table of Vector3 positions to set, where the key is the index and the value is the position."
}
],
"line": 220,
"namespace": "worldeditadditions_core.pos",
"line_last": 223,
"name": "set_multi",
"instanced": false,
"args": [
"player_name",
"pos_list"
],
"text": "--- Sets multiple positions for the given player.\n-- @param\tplayer_name\t\tstring\t\t\t\tThe name of the player to set the positions for.\n-- @param\tpos_list\t\ttable<int, Vector3>\tA table of Vector3 positions to set, where the key is the index and the value is the position.\nlocal function set_multi(player_name, pos_list)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\t\t\t\tThe name of the player to set the positions for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set the positions for."
},
{
"directive": "param",
"text": "pos_list\t\ttable<int, Vector3>\tA table of Vector3 positions to set, where the key is the index and the value is the position.",
"name": "pos_list",
"type": "table<int, Vector3>",
"description": "A table of Vector3 positions to set, where the key is the index and the value is the position."
}
],
"examples": [],
"name_full": "worldeditadditions_core.pos.set_multi",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L221-L224"
}
set1 🔗
Convenience function that set position 1 for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to set pos1 for. |
pos | Vector3? | nil | The new Vector3 for pos1 to set. |
Returns
bool
:
Whether the operation was successful or not, but in this case will always return true so can be ignored.
Source
--- Convenience function that set position 1 for the given player.
-- @param player_name string The name of the player to set pos1 for.
-- @param pos Vector3? The new Vector3 for pos1 to set.
-- @returns bool Whether the operation was successful or not, but in this case will always return true so can be ignored.
local function set1(player_name, pos)
{
"type": "function",
"internal": false,
"description": "Convenience function that set position 1 for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\t\tThe name of the player to set pos1 for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set pos1 for."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3?\tThe new Vector3 for pos1 to set.",
"name": "pos",
"type": "Vector3?",
"description": "The new Vector3 for pos1 to set."
},
{
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not, but in this case will always return true so can be ignored.",
"type": "bool",
"description": "Whether the operation was successful or not, but in this case will always return true so can be ignored."
}
],
"line": 205,
"namespace": "worldeditadditions_core.pos",
"line_last": 209,
"name": "set1",
"instanced": false,
"args": [
"player_name",
"pos"
],
"text": "--- Convenience function that set position 1 for the given player.\n-- @param\tplayer_name\t\tstring\t\tThe name of the player to set pos1 for.\n-- @param\tpos\t\t\t\tVector3?\tThe new Vector3 for pos1 to set.\n-- @returns\tbool\t\t\tWhether the operation was successful or not, but in this case will always return true so can be ignored.\nlocal function set1(player_name, pos)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\t\tThe name of the player to set pos1 for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set pos1 for."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3?\tThe new Vector3 for pos1 to set.",
"name": "pos",
"type": "Vector3?",
"description": "The new Vector3 for pos1 to set."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not, but in this case will always return true so can be ignored.",
"type": "bool",
"description": "Whether the operation was successful or not, but in this case will always return true so can be ignored."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.set1",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L206-L210"
}
set2 🔗
Convenience function that set position 2 for the given player.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to set pos1 for. |
pos | Vector3? | nil | The new Vector3 for pos2 to set. |
Returns
bool
:
Whether the operation was successful or not, but in this case will always return true so can be ignored.
Source
--- Convenience function that set position 2 for the given player.
-- @param player_name string The name of the player to set pos1 for.
-- @param pos Vector3? The new Vector3 for pos2 to set.
-- @returns bool Whether the operation was successful or not, but in this case will always return true so can be ignored.
local function set2(player_name, pos)
{
"type": "function",
"internal": false,
"description": "Convenience function that set position 2 for the given player.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\t\tThe name of the player to set pos1 for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set pos1 for."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3?\tThe new Vector3 for pos2 to set.",
"name": "pos",
"type": "Vector3?",
"description": "The new Vector3 for pos2 to set."
},
{
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not, but in this case will always return true so can be ignored.",
"type": "bool",
"description": "Whether the operation was successful or not, but in this case will always return true so can be ignored."
}
],
"line": 212,
"namespace": "worldeditadditions_core.pos",
"line_last": 216,
"name": "set2",
"instanced": false,
"args": [
"player_name",
"pos"
],
"text": "--- Convenience function that set position 2 for the given player.\n-- @param\tplayer_name\t\tstring\t\tThe name of the player to set pos1 for.\n-- @param\tpos\t\t\t\tVector3?\tThe new Vector3 for pos2 to set.\n-- @returns\tbool\t\t\tWhether the operation was successful or not, but in this case will always return true so can be ignored.\nlocal function set2(player_name, pos)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\t\tThe name of the player to set pos1 for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to set pos1 for."
},
{
"directive": "param",
"text": "pos\t\t\t\tVector3?\tThe new Vector3 for pos2 to set.",
"name": "pos",
"type": "Vector3?",
"description": "The new Vector3 for pos2 to set."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\t\tWhether the operation was successful or not, but in this case will always return true so can be ignored.",
"type": "bool",
"description": "Whether the operation was successful or not, but in this case will always return true so can be ignored."
},
"examples": [],
"name_full": "worldeditadditions_core.pos.set2",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L213-L217"
}
unmark 🔗
Hides the visual markers for the given player's positions and defined region, but does not clear the points.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player to operate on. |
markers | bool | true | Whether to hide positional markers. |
walls | bool | true | Whether to hide the marker walls. |
Returns
void
Source
--- Hides the visual markers for the given player's positions and defined region, but does not clear the points.
-- @param player_name string The name of the player to operate on.
-- @param markers=true bool Whether to hide positional markers.
-- @param walls=true bool Whether to hide the marker walls.
-- @returns void
local function unmark(player_name, markers, walls)
{
"type": "function",
"internal": false,
"description": "Hides the visual markers for the given player's positions and defined region, but does not clear the points.",
"directives": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to operate on.",
"name": "player_name",
"type": "string",
"description": "The name of the player to operate on."
},
{
"directive": "param",
"text": "markers=true\tbool\tWhether to hide positional markers.",
"name": "markers",
"type": "bool",
"description": "Whether to hide positional markers.",
"default_value": "true"
},
{
"directive": "param",
"text": "walls=true\t\tbool\tWhether to hide the marker walls.",
"name": "walls",
"type": "bool",
"description": "Whether to hide the marker walls.",
"default_value": "true"
},
{
"directive": "returns",
"text": "void",
"type": "void"
}
],
"line": 292,
"namespace": "worldeditadditions_core.pos",
"line_last": 297,
"name": "unmark",
"instanced": false,
"args": [
"player_name",
"markers",
"walls"
],
"text": "--- Hides the visual markers for the given player's positions and defined region, but does not clear the points.\n-- @param\tplayer_name\t\tstring\tThe name of the player to operate on.\n-- @param\tmarkers=true\tbool\tWhether to hide positional markers.\n-- @param\twalls=true\t\tbool\tWhether to hide the marker walls.\n-- @returns\tvoid\nlocal function unmark(player_name, markers, walls)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\tThe name of the player to operate on.",
"name": "player_name",
"type": "string",
"description": "The name of the player to operate on."
},
{
"directive": "param",
"text": "markers=true\tbool\tWhether to hide positional markers.",
"name": "markers",
"type": "bool",
"description": "Whether to hide positional markers.",
"default_value": "true"
},
{
"directive": "param",
"text": "walls=true\t\tbool\tWhether to hide the marker walls.",
"name": "walls",
"type": "bool",
"description": "Whether to hide the marker walls.",
"default_value": "true"
}
],
"returns": {
"directive": "returns",
"text": "void",
"type": "void"
},
"examples": [],
"name_full": "worldeditadditions_core.pos.unmark",
"filename": "worldeditadditions_core/core/pos.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/pos.lua#L293-L298"
}
Events
clear 🔗
The positions for a player have been cleared.
Format
{ player_name: string }
Source
--- The positions for a player have been cleared.
-- @event clear
-- @format { player_name: string }
{
"type": "event",
"internal": false,
"description": "The positions for a player have been cleared.",
"directives": [
{
"directive": "event",
"text": "clear"
},
{
"directive": "format",
"text": "{ player_name: string }"
}
],
"line": 29,
"namespace": "worldeditadditions_core.pos",
"event": "clear",
"line_last": 32,
"text": "--- The positions for a player have been cleared.\n-- @event\tclear\n-- @format\t{ player_name: string }",
"params": [],
"examples": [],
"filename": "worldeditadditions_core/core/pos.lua"
}
mark 🔗
It is requested that all position/region marker UI elements be shown once more for the given player.
Format
{ player_name: string }
Source
--- It is requested that all position/region marker UI elements be shown once more for the given player.
-- @event mark
-- @format { player_name: string }
{
"type": "event",
"internal": false,
"description": "It is requested that all position/region marker UI elements be shown once more for the given player.",
"directives": [
{
"directive": "event",
"text": "mark"
},
{
"directive": "format",
"text": "{ player_name: string }"
}
],
"line": 37,
"namespace": "worldeditadditions_core.pos",
"event": "mark",
"line_last": 40,
"text": "--- It is requested that all position/region marker UI elements be shown once more for the given player.\n-- @event\tmark\n-- @format\t{ player_name: string }",
"params": [],
"examples": [],
"filename": "worldeditadditions_core/core/pos.lua"
}
pop 🔗
A new position has been pushed onto a player's stack.
Format
{ player_name: string, i: number, pos: Vector3 }
Source
--- A new position has been pushed onto a player's stack.
-- @event pop
-- @format { player_name: string, i: number, pos: Vector3 }
{
"type": "event",
"internal": false,
"description": "A new position has been pushed onto a player's stack.",
"directives": [
{
"directive": "event",
"text": "pop"
},
{
"directive": "format",
"text": "{ player_name: string, i: number, pos: Vector3 }"
}
],
"line": 25,
"namespace": "worldeditadditions_core.pos",
"event": "pop",
"line_last": 28,
"text": "--- A new position has been pushed onto a player's stack.\n-- @event\tpop\n-- @format\t{ player_name: string, i: number, pos: Vector3 }",
"params": [],
"examples": [],
"filename": "worldeditadditions_core/core/pos.lua"
}
push 🔗
A new position has been pushed onto a player's stack.
Format
{ player_name: string, i: number, pos: Vector3 }
Source
--- A new position has been pushed onto a player's stack.
-- @event push
-- @format { player_name: string, i: number, pos: Vector3 }
{
"type": "event",
"internal": false,
"description": "A new position has been pushed onto a player's stack.",
"directives": [
{
"directive": "event",
"text": "push"
},
{
"directive": "format",
"text": "{ player_name: string, i: number, pos: Vector3 }"
}
],
"line": 21,
"namespace": "worldeditadditions_core.pos",
"event": "push",
"line_last": 24,
"text": "--- A new position has been pushed onto a player's stack.\n-- @event\tpush\n-- @format\t{ player_name: string, i: number, pos: Vector3 }",
"params": [],
"examples": [],
"filename": "worldeditadditions_core/core/pos.lua"
}
set 🔗
A new position has been set in a player's list at a specific position.
Format
{ player_name: string, i: number, pos: Vector3 }
Examples
Example 1
{
player_name = "some_player_name",
i = 3,
pos = <Vector3> { x = 456, y = 64, z = 9045 }
}
Source
--- A new position has been set in a player's list at a specific position.
-- @event set
-- @format { player_name: string, i: number, pos: Vector3 }
-- @example
-- {
-- player_name = "some_player_name",
-- i = 3,
-- pos = <Vector3> { x = 456, y = 64, z = 9045 }
-- }
{
"type": "event",
"internal": false,
"description": "A new position has been set in a player's list at a specific position.",
"directives": [
{
"directive": "event",
"text": "set"
},
{
"directive": "format",
"text": "{ player_name: string, i: number, pos: Vector3 }"
},
{
"directive": "example",
"text": "{\n\tplayer_name = \"some_player_name\",\n\ti = 3,\n\tpos = <Vector3> { x = 456, y = 64, z = 9045 }\n}",
"description": "Example 1",
"example": "{\n\tplayer_name = \"some_player_name\",\n\ti = 3,\n\tpos = <Vector3> { x = 456, y = 64, z = 9045 }\n}",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#DBD7CAEE\">{</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">\tplayer_name</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#C98A7D77\"> \"</span><span style=\"color:#C98A7D\">some_player_name</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">,</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">\ti</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 3</span><span style=\"color:#DBD7CAEE\">,</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">\tpos</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#CB7676\"> &#x3C;Vector3></span><span style=\"color:#DBD7CAEE\"> { </span><span style=\"color:#BD976A\">x</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 456</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#BD976A\">y</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 64</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#BD976A\">z</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 9045</span><span style=\"color:#DBD7CAEE\"> }</span></span>\n<span class=\"line\"><span style=\"color:#DBD7CAEE\">}</span></span></code></pre>"
}
],
"line": 11,
"namespace": "worldeditadditions_core.pos",
"event": "set",
"line_last": 20,
"text": "--- A new position has been set in a player's list at a specific position.\n-- @event\tset\n-- @format\t{ player_name: string, i: number, pos: Vector3 }\n-- @example\n-- {\n-- \tplayer_name = \"some_player_name\",\n-- \ti = 3,\n-- \tpos = <Vector3> { x = 456, y = 64, z = 9045 }\n-- }",
"params": [],
"examples": [
{
"directive": "example",
"text": "{\n\tplayer_name = \"some_player_name\",\n\ti = 3,\n\tpos = <Vector3> { x = 456, y = 64, z = 9045 }\n}",
"description": "Example 1",
"example": "{\n\tplayer_name = \"some_player_name\",\n\ti = 3,\n\tpos = <Vector3> { x = 456, y = 64, z = 9045 }\n}",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#DBD7CAEE\">{</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">\tplayer_name</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#C98A7D77\"> \"</span><span style=\"color:#C98A7D\">some_player_name</span><span style=\"color:#C98A7D77\">\"</span><span style=\"color:#DBD7CAEE\">,</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">\ti</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 3</span><span style=\"color:#DBD7CAEE\">,</span></span>\n<span class=\"line\"><span style=\"color:#BD976A\">\tpos</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#CB7676\"> &#x3C;Vector3></span><span style=\"color:#DBD7CAEE\"> { </span><span style=\"color:#BD976A\">x</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 456</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#BD976A\">y</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 64</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#BD976A\">z</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#4C9A91\"> 9045</span><span style=\"color:#DBD7CAEE\"> }</span></span>\n<span class=\"line\"><span style=\"color:#DBD7CAEE\">}</span></span></code></pre>"
}
],
"filename": "worldeditadditions_core/core/pos.lua"
}
unmark 🔗
It is requested that all position/region marker UI elements be hidden for the given player.
Format
{ player_name: string, markers: bool, walls: bool }
Source
--- It is requested that all position/region marker UI elements be hidden for the given player.
-- @event unmark
-- @format { player_name: string, markers: bool, walls: bool }
{
"type": "event",
"internal": false,
"description": "It is requested that all position/region marker UI elements be hidden for the given player.",
"directives": [
{
"directive": "event",
"text": "unmark"
},
{
"directive": "format",
"text": "{ player_name: string, markers: bool, walls: bool }"
}
],
"line": 33,
"namespace": "worldeditadditions_core.pos",
"event": "unmark",
"line_last": 36,
"text": "--- It is requested that all position/region marker UI elements be hidden for the given player.\n-- @event\tunmark\n-- @format\t{ player_name: string, markers: bool, walls: bool }",
"params": [],
"examples": [],
"filename": "worldeditadditions_core/core/pos.lua"
}
Promise 🔗
Javascript Promises, implemented in Lua In other words, a wrapper to manage asynchronous operations. Due to limitations of Lua, while this Promise API is similar it isn't exactly the same as in JS. Most notably is that there is a .run() function you must call AFTER you call .then_() as many times as you need.
Also, .then_() does not return a thenable value but the SAME ORIGINAL promise, as we stack up all functions and then execute them in order once you call .run(). This has the subtle implication that Promise.state is not set to "fulfilled" until ALL functions in the chain have been called.
Additionally, every .then_(function(...) end) MAY return a promise themselves if they wish. These promises WILL be automatically executed when you call .run() on the PARENT promise, as they are considered required for the parent Promise function chain to run to completion.
Functions
new 🔗
Creates a new Promise instance.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
fn | function | nil | The function to wrap into a promise. |
Returns
nil
Source
--- Creates a new Promise instance.
-- @param fn function The function to wrap into a promise.
function Promise.new(fn)
{
"type": "function",
"internal": false,
"description": "Creates a new Promise instance.",
"directives": [
{
"directive": "param",
"text": "fn \tfunction\tThe function to wrap into a promise.",
"name": "fn ",
"type": "function",
"description": "The function to wrap into a promise."
}
],
"line": 14,
"namespace": "worldeditadditions_core.Promise",
"line_last": 16,
"name": "new",
"instanced": false,
"args": [
"fn"
],
"text": "--- Creates a new Promise instance.\n-- @param fn \tfunction\tThe function to wrap into a promise.\nfunction Promise.new(fn)",
"params": [
{
"directive": "param",
"text": "fn \tfunction\tThe function to wrap into a promise.",
"name": "fn ",
"type": "function",
"description": "The function to wrap into a promise."
}
],
"examples": [],
"name_full": "worldeditadditions_core.Promise.new",
"filename": "promise.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/promise.lua#L15-L17"
}
run 🔗
Executes the function this Promise is wrapping all associated chained functions in sequence. This is a separate method for portability, since Lua does not implement setTimeout which is required to ensure that if an non-async function is wrapped the parent function still has time to call .then_() before it finishes and the associated .then_()ed functions are attached correctly.
WARNING: If you call .then_() AFTER calling .run(), your .then_()ed function may not be called correctly!
Arguments
This function takes no arguments.
Returns
Promise
:
The current promise, for daisy chaining purposes.
Source
--- Executes the function this Promise is wrapping all associated chained functions in sequence.
-- This is a separate method for portability, since Lua does not implement setTimeout which is required to ensure that if an non-async function is wrapped the parent function still has time to call .then_() before it finishes and the associated .then_()ed functions are attached correctly.
--
-- WARNING: If you call .then_() AFTER calling .run(), your .then_()ed function may not be called correctly!
-- @returns Promise The current promise, for daisy chaining purposes.
function Promise.run(self)
{
"type": "function",
"internal": false,
"description": "Executes the function this Promise is wrapping all associated chained functions in sequence.\nThis is a separate method for portability, since Lua does not implement setTimeout which is required to ensure that if an non-async function is wrapped the parent function still has time to call .then_() before it finishes and the associated .then_()ed functions are attached correctly.\n\nWARNING: If you call .then_() AFTER calling .run(), your .then_()ed function may not be called correctly!",
"directives": [
{
"directive": "returns",
"text": "Promise\tThe current promise, for daisy chaining purposes.",
"type": "Promise",
"description": "The current promise, for daisy chaining purposes."
}
],
"line": 127,
"namespace": "worldeditadditions_core.Promise",
"line_last": 132,
"name": "run",
"instanced": false,
"args": [
"self"
],
"text": "--- Executes the function this Promise is wrapping all associated chained functions in sequence.\n-- This is a separate method for portability, since Lua does not implement setTimeout which is required to ensure that if an non-async function is wrapped the parent function still has time to call .then_() before it finishes and the associated .then_()ed functions are attached correctly.\n-- \n-- WARNING: If you call .then_() AFTER calling .run(), your .then_()ed function may not be called correctly!\n-- @returns\tPromise\tThe current promise, for daisy chaining purposes.\nfunction Promise.run(self)",
"params": [],
"returns": {
"directive": "returns",
"text": "Promise\tThe current promise, for daisy chaining purposes.",
"type": "Promise",
"description": "The current promise, for daisy chaining purposes."
},
"examples": [],
"name_full": "worldeditadditions_core.Promise.run",
"filename": "promise.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/promise.lua#L128-L133"
}
Queue 🔗
A Queue implementation Taken & adapted from https://www.lua.org/pil/11.4.html
Functions
contains 🔗
Determines whether a given value is present in this queue or not.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
value | any | nil | The value to check. |
Returns
bool
:
Whether the given value exists in the queue or not.
Source
--- Determines whether a given value is present in this queue or not.
-- @param value any The value to check.
-- @returns bool Whether the given value exists in the queue or not.
function Queue:contains(value)
{
"type": "function",
"internal": false,
"description": "Determines whether a given value is present in this queue or not.",
"directives": [
{
"directive": "param",
"text": "value\tany\t\tThe value to check.",
"name": "value",
"type": "any",
"description": "The value to check."
},
{
"directive": "returns",
"text": "bool\tWhether the given value exists in the queue or not.",
"type": "bool",
"description": "Whether the given value exists in the queue or not."
}
],
"line": 25,
"namespace": "worldeditadditions_core.Queue",
"line_last": 28,
"name": "contains",
"instanced": true,
"args": [
"value"
],
"text": "--- Determines whether a given value is present in this queue or not.\n-- @param\tvalue\tany\t\tThe value to check.\n-- @returns\tbool\tWhether the given value exists in the queue or not.\nfunction Queue:contains(value)",
"params": [
{
"directive": "param",
"text": "value\tany\t\tThe value to check.",
"name": "value",
"type": "any",
"description": "The value to check."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the given value exists in the queue or not.",
"type": "bool",
"description": "Whether the given value exists in the queue or not."
},
"examples": [],
"name_full": "worldeditadditions_core.Queue.contains",
"filename": "worldeditadditions_core/utils/queue.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/queue.lua#L26-L29"
}
dequeue 🔗
Dequeues an item from the front of the queue.
Arguments
This function takes no arguments.
Returns
any|nil
:
Returns the item at the front of the queue, or nil if no items are currently enqueued.
Source
--- Dequeues an item from the front of the queue.
-- @returns any|nil Returns the item at the front of the queue, or nil if no items are currently enqueued.
function Queue:dequeue()
{
"type": "function",
"internal": false,
"description": "Dequeues an item from the front of the queue.",
"directives": [
{
"directive": "returns",
"text": "any|nil\t\tReturns the item at the front of the queue, or nil if no items are currently enqueued.",
"type": "any|nil",
"description": "Returns the item at the front of the queue, or nil if no items are currently enqueued."
}
],
"line": 51,
"namespace": "worldeditadditions_core.Queue",
"line_last": 53,
"name": "dequeue",
"instanced": true,
"args": [
""
],
"text": "--- Dequeues an item from the front of the queue.\n-- @returns\t\tany|nil\t\tReturns the item at the front of the queue, or nil if no items are currently enqueued. \nfunction Queue:dequeue()",
"params": [],
"returns": {
"directive": "returns",
"text": "any|nil\t\tReturns the item at the front of the queue, or nil if no items are currently enqueued.",
"type": "any|nil",
"description": "Returns the item at the front of the queue, or nil if no items are currently enqueued."
},
"examples": [],
"name_full": "worldeditadditions_core.Queue.dequeue",
"filename": "worldeditadditions_core/utils/queue.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/queue.lua#L52-L54"
}
enqueue 🔗
Adds a new value to the end of the queue.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
value | any | nil | The new value to add to the end of the queue. |
Returns
number
:
The index of the value that was added to the queue.
Source
--- Adds a new value to the end of the queue.
-- @param value any The new value to add to the end of the queue.
-- @returns number The index of the value that was added to the queue.
function Queue:enqueue(value)
{
"type": "function",
"internal": false,
"description": "Adds a new value to the end of the queue.",
"directives": [
{
"directive": "param",
"text": "value\tany\t\tThe new value to add to the end of the queue.",
"name": "value",
"type": "any",
"description": "The new value to add to the end of the queue."
},
{
"directive": "returns",
"text": "number\tThe index of the value that was added to the queue.",
"type": "number",
"description": "The index of the value that was added to the queue."
}
],
"line": 15,
"namespace": "worldeditadditions_core.Queue",
"line_last": 18,
"name": "enqueue",
"instanced": true,
"args": [
"value"
],
"text": "--- Adds a new value to the end of the queue.\n-- @param\tvalue\tany\t\tThe new value to add to the end of the queue.\n-- @returns\tnumber\tThe index of the value that was added to the queue.\nfunction Queue:enqueue(value)",
"params": [
{
"directive": "param",
"text": "value\tany\t\tThe new value to add to the end of the queue.",
"name": "value",
"type": "any",
"description": "The new value to add to the end of the queue."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe index of the value that was added to the queue.",
"type": "number",
"description": "The index of the value that was added to the queue."
},
"examples": [],
"name_full": "worldeditadditions_core.Queue.enqueue",
"filename": "worldeditadditions_core/utils/queue.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/queue.lua#L16-L19"
}
is_empty 🔗
Returns whether the queue is empty or not.
Arguments
This function takes no arguments.
Returns
bool
:
Whether the queue is empty or not.
Source
--- Returns whether the queue is empty or not.
-- @returns bool Whether the queue is empty or not.
function Queue:is_empty()
{
"type": "function",
"internal": false,
"description": "Returns whether the queue is empty or not.",
"directives": [
{
"directive": "returns",
"text": "bool\tWhether the queue is empty or not.",
"type": "bool",
"description": "Whether the queue is empty or not."
}
],
"line": 37,
"namespace": "worldeditadditions_core.Queue",
"line_last": 39,
"name": "is_empty",
"instanced": true,
"args": [
""
],
"text": "--- Returns whether the queue is empty or not.\n-- @returns\tbool\tWhether the queue is empty or not.\nfunction Queue:is_empty()",
"params": [],
"returns": {
"directive": "returns",
"text": "bool\tWhether the queue is empty or not.",
"type": "bool",
"description": "Whether the queue is empty or not."
},
"examples": [],
"name_full": "worldeditadditions_core.Queue.is_empty",
"filename": "worldeditadditions_core/utils/queue.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/queue.lua#L38-L40"
}
new 🔗
Creates a new queue instance.
Arguments
This function takes no arguments.
Returns
Queue
Source
--- Creates a new queue instance.
-- @returns Queue
function Queue.new()
{
"type": "function",
"internal": false,
"description": "Creates a new queue instance.",
"directives": [
{
"directive": "returns",
"text": "Queue",
"type": "Queue"
}
],
"line": 7,
"namespace": "worldeditadditions_core.Queue",
"line_last": 9,
"name": "new",
"instanced": false,
"args": [
""
],
"text": "--- Creates a new queue instance.\n-- @returns\tQueue\nfunction Queue.new()",
"params": [],
"returns": {
"directive": "returns",
"text": "Queue",
"type": "Queue"
},
"examples": [],
"name_full": "worldeditadditions_core.Queue.new",
"filename": "worldeditadditions_core/utils/queue.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/queue.lua#L8-L10"
}
remove_index 🔗
Removes the item with the given index from the queue. Item indexes do not change as the items in a queue are added and removed.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
number | The index of the item to remove from the queue. | nil |
Returns
nil
Source
--- Removes the item with the given index from the queue.
-- Item indexes do not change as the items in a queue are added and removed.
-- @param number The index of the item to remove from the queue.
-- @returns nil
function Queue:remove_index(index)
{
"type": "function",
"internal": false,
"description": "Removes the item with the given index from the queue.\nItem indexes do not change as the items in a queue are added and removed.",
"directives": [
{
"directive": "param",
"text": "number\t\tThe index of the item to remove from the queue.",
"name": "number",
"type": "The index of the item to remove from the queue."
},
{
"directive": "returns",
"text": "nil",
"type": "nil"
}
],
"line": 43,
"namespace": "worldeditadditions_core.Queue",
"line_last": 47,
"name": "remove_index",
"instanced": true,
"args": [
"index"
],
"text": "--- Removes the item with the given index from the queue.\n-- Item indexes do not change as the items in a queue are added and removed.\n-- @param\t\tnumber\t\tThe index of the item to remove from the queue.\n-- @returns\t\tnil\nfunction Queue:remove_index(index)",
"params": [
{
"directive": "param",
"text": "number\t\tThe index of the item to remove from the queue.",
"name": "number",
"type": "The index of the item to remove from the queue."
}
],
"returns": {
"directive": "returns",
"text": "nil",
"type": "nil"
},
"examples": [],
"name_full": "worldeditadditions_core.Queue.remove_index",
"filename": "worldeditadditions_core/utils/queue.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/queue.lua#L44-L48"
}
rotation 🔗
Functions
find_rotated_vm 🔗
Applies a given list of rotations rotlist to rotate pos1 and pos2 around a given origin, and returns a pos1/pos2 pair of a region that bounds the rotated area. The returned pos1/pos2 are guaranteed to be integer values that fully enclose the rotated region. This function is designed to be used to e.g. find the bounds of a region to pass to a VoxelManip to ensure we grab everything.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | Position 1 to rotate. |
pos2 | Vector3 | nil | Position 2 to rotate. |
origin | Vector3 | nil | The position to rotate pos1 and pos2 around. May be a decimal value. |
rotlist | table<{axis: string, rad: number}> | nil | The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information. |
Returns
Vector3,Vector3
:
A pos1 & pos2 that fully enclose the rotated region as described above.
Source
--- Applies a given list of rotations rotlist to rotate pos1 and pos2 around a given origin, and returns a pos1/pos2 pair of a region that bounds the rotated area.
-- The returned pos1/pos2 are guaranteed to be integer values that fully enclose the rotated region. This function is designed to be used to e.g. find the bounds of a region to pass to a VoxelManip to ensure we grab everything.
-- @param pos1 Vector3 Position 1 to rotate.
-- @param pos2 Vector3 Position 2 to rotate.
-- @param origin Vector3 The position to rotate pos1 and pos2 around. May be a decimal value.
-- @param rotlist table<{axis: string, rad: number}> The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information.
-- @returns Vector3,Vector3 A pos1 & pos2 that fully enclose the rotated region as described above.
local function find_rotated_vm(pos1, pos2, origin, rotlist)
{
"type": "function",
"internal": false,
"description": "Applies a given list of rotations rotlist to rotate pos1 and pos2 around a given origin, and returns a pos1/pos2 pair of a region that bounds the rotated area.\nThe returned pos1/pos2 are guaranteed to be integer values that fully enclose the rotated region. This function is designed to be used to e.g. find the bounds of a region to pass to a VoxelManip to ensure we grab everything.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 to rotate.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 to rotate."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 to rotate.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 to rotate."
},
{
"directive": "param",
"text": "origin\tVector3\t\tThe position to rotate pos1 and pos2 around. May be a decimal value.",
"name": "origin",
"type": "Vector3",
"description": "The position to rotate pos1 and pos2 around. May be a decimal value."
},
{
"directive": "param",
"text": "rotlist\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information.",
"name": "rotlist",
"type": "table<{axis: string, rad: number}>",
"description": "The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information."
},
{
"directive": "returns",
"text": "Vector3,Vector3\tA pos1 & pos2 that fully enclose the rotated region as described above.",
"type": "Vector3,Vector3",
"description": "A pos1 & pos2 that fully enclose the rotated region as described above."
}
],
"line": 42,
"namespace": "worldeditadditions_core.rotation",
"line_last": 49,
"name": "find_rotated_vm",
"instanced": false,
"args": [
"pos1",
"pos2",
"origin",
"rotlist"
],
"text": "--- Applies a given list of rotations rotlist to rotate pos1 and pos2 around a given origin, and returns a pos1/pos2 pair of a region that bounds the rotated area.\n-- The returned pos1/pos2 are guaranteed to be integer values that fully enclose the rotated region. This function is designed to be used to e.g. find the bounds of a region to pass to a VoxelManip to ensure we grab everything.\n-- @param\tpos1\tVector3\t\tPosition 1 to rotate.\n-- @param\tpos2\tVector3\t\tPosition 2 to rotate.\n-- @param\torigin\tVector3\t\tThe position to rotate pos1 and pos2 around. May be a decimal value.\n-- @param\trotlist\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information.\n-- @returns\tVector3,Vector3\tA pos1 & pos2 that fully enclose the rotated region as described above.\nlocal function find_rotated_vm(pos1, pos2, origin, rotlist)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tPosition 1 to rotate.",
"name": "pos1",
"type": "Vector3",
"description": "Position 1 to rotate."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tPosition 2 to rotate.",
"name": "pos2",
"type": "Vector3",
"description": "Position 2 to rotate."
},
{
"directive": "param",
"text": "origin\tVector3\t\tThe position to rotate pos1 and pos2 around. May be a decimal value.",
"name": "origin",
"type": "Vector3",
"description": "The position to rotate pos1 and pos2 around. May be a decimal value."
},
{
"directive": "param",
"text": "rotlist\ttable<{axis: string, rad: number}>\tThe list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information.",
"name": "rotlist",
"type": "table<{axis: string, rad: number}>",
"description": "The list of rotations. Rotations will be processed in order. Each rotation is a table with a SINGLE axis as a string (x, y, z, -x, -y, or -z; the axis parameter), and an amount in radians to rotate by (the rad parameter). See worldeditadditions.rotate() for more information."
}
],
"returns": {
"directive": "returns",
"text": "Vector3,Vector3\tA pos1 & pos2 that fully enclose the rotated region as described above.",
"type": "Vector3,Vector3",
"description": "A pos1 & pos2 that fully enclose the rotated region as described above."
},
"examples": [],
"name_full": "worldeditadditions_core.rotation.find_rotated_vm",
"filename": "worldeditadditions_core/utils/rotation.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/rotation.lua#L43-L50"
}
Set 🔗
Set implementation for Lua.
Functions
add 🔗
Adds item(s) to set.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | set | nil | Set to manipulate. |
i | not nil | nil | Values(s) to add. |
Returns
bool
:
Success of operation.
Source
--- Adds item(s) to set.
-- @param a set Set to manipulate.
-- @param i not nil Values(s) to add.
-- @returns bool Success of operation.
function Set.add(a,i)
{
"type": "function",
"internal": false,
"description": "Adds item(s) to set.",
"directives": [
{
"directive": "param",
"text": "a\tset\tSet to manipulate.",
"name": "a",
"type": "set",
"description": "Set to manipulate."
},
{
"directive": "param",
"text": "i\tnot nil\tValues(s) to add.",
"name": "i",
"type": "not nil",
"description": "Values(s) to add."
},
{
"directive": "returns",
"text": "bool\tSuccess of operation.",
"type": "bool",
"description": "Success of operation."
}
],
"line": 44,
"namespace": "worldeditadditions_core.Set",
"line_last": 48,
"name": "add",
"instanced": false,
"args": [
"a",
"i"
],
"text": "--- Adds item(s) to set.\n-- @param\ta\tset\tSet to manipulate.\n-- @param\ti\tnot nil\tValues(s) to add.\n-- @returns\tbool\tSuccess of operation.\nfunction Set.add(a,i)",
"params": [
{
"directive": "param",
"text": "a\tset\tSet to manipulate.",
"name": "a",
"type": "set",
"description": "Set to manipulate."
},
{
"directive": "param",
"text": "i\tnot nil\tValues(s) to add.",
"name": "i",
"type": "not nil",
"description": "Values(s) to add."
}
],
"returns": {
"directive": "returns",
"text": "bool\tSuccess of operation.",
"type": "bool",
"description": "Success of operation."
},
"examples": [],
"name_full": "worldeditadditions_core.Set.add",
"filename": "worldeditadditions_core/utils/set.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/set.lua#L45-L49"
}
delete 🔗
Deletes item(s) from set.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | set | nil | Set to manipulate. |
i | not nil | nil | Values(s) to delete. |
Returns
bool
:
Success of operation.
Source
--- Deletes item(s) from set.
-- @param a set Set to manipulate.
-- @param i not nil Values(s) to delete.
-- @returns bool Success of operation.
function Set.delete(a,i)
{
"type": "function",
"internal": false,
"description": "Deletes item(s) from set.",
"directives": [
{
"directive": "param",
"text": "a\tset\tSet to manipulate.",
"name": "a",
"type": "set",
"description": "Set to manipulate."
},
{
"directive": "param",
"text": "i\tnot nil\tValues(s) to delete.",
"name": "i",
"type": "not nil",
"description": "Values(s) to delete."
},
{
"directive": "returns",
"text": "bool\tSuccess of operation.",
"type": "bool",
"description": "Success of operation."
}
],
"line": 57,
"namespace": "worldeditadditions_core.Set",
"line_last": 61,
"name": "delete",
"instanced": false,
"args": [
"a",
"i"
],
"text": "--- Deletes item(s) from set.\n-- @param\ta\tset\tSet to manipulate.\n-- @param\ti\tnot nil\tValues(s) to delete.\n-- @returns\tbool\tSuccess of operation.\nfunction Set.delete(a,i)",
"params": [
{
"directive": "param",
"text": "a\tset\tSet to manipulate.",
"name": "a",
"type": "set",
"description": "Set to manipulate."
},
{
"directive": "param",
"text": "i\tnot nil\tValues(s) to delete.",
"name": "i",
"type": "not nil",
"description": "Values(s) to delete."
}
],
"returns": {
"directive": "returns",
"text": "bool\tSuccess of operation.",
"type": "bool",
"description": "Success of operation."
},
"examples": [],
"name_full": "worldeditadditions_core.Set.delete",
"filename": "worldeditadditions_core/utils/set.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/set.lua#L58-L62"
}
has 🔗
Checks if value(s) are present in set.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | set | nil | Set to inspect. |
i | not nil | nil | Values(s) to check. |
Returns
bool
:
Value(s) are present?
Source
--- Checks if value(s) are present in set.
-- @param a set Set to inspect.
-- @param i not nil Values(s) to check.
-- @returns bool Value(s) are present?
function Set.has(a,i)
{
"type": "function",
"internal": false,
"description": "Checks if value(s) are present in set.",
"directives": [
{
"directive": "param",
"text": "a\tset\tSet to inspect.",
"name": "a",
"type": "set",
"description": "Set to inspect."
},
{
"directive": "param",
"text": "i\tnot nil\tValues(s) to check.",
"name": "i",
"type": "not nil",
"description": "Values(s) to check."
},
{
"directive": "returns",
"text": "bool\tValue(s) are present?",
"type": "bool",
"description": "Value(s) are present?"
}
],
"line": 70,
"namespace": "worldeditadditions_core.Set",
"line_last": 74,
"name": "has",
"instanced": false,
"args": [
"a",
"i"
],
"text": "--- Checks if value(s) are present in set.\n-- @param\ta\tset\tSet to inspect.\n-- @param\ti\tnot nil\tValues(s) to check.\n-- @returns\tbool\tValue(s) are present?\nfunction Set.has(a,i)",
"params": [
{
"directive": "param",
"text": "a\tset\tSet to inspect.",
"name": "a",
"type": "set",
"description": "Set to inspect."
},
{
"directive": "param",
"text": "i\tnot nil\tValues(s) to check.",
"name": "i",
"type": "not nil",
"description": "Values(s) to check."
}
],
"returns": {
"directive": "returns",
"text": "bool\tValue(s) are present?",
"type": "bool",
"description": "Value(s) are present?"
},
"examples": [],
"name_full": "worldeditadditions_core.Set.has",
"filename": "worldeditadditions_core/utils/set.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/set.lua#L71-L75"
}
new 🔗
Creates a new set.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
i | any | nil | Initial values(s) of the set. |
Returns
Set
:
A table of keys equal to true.
Source
--- Creates a new set.
-- @param i any Initial values(s) of the set.
-- @returns Set A table of keys equal to true.
function Set.new(i)
{
"type": "function",
"internal": false,
"description": "Creates a new set.",
"directives": [
{
"directive": "param",
"text": "i\tany\tInitial values(s) of the set.",
"name": "i",
"type": "any",
"description": "Initial values(s) of the set."
},
{
"directive": "returns",
"text": "Set\tA table of keys equal to true.",
"type": "Set",
"description": "A table of keys equal to true."
}
],
"line": 29,
"namespace": "worldeditadditions_core.Set",
"line_last": 32,
"name": "new",
"instanced": false,
"args": [
"i"
],
"text": "--- Creates a new set.\n-- @param\ti\tany\tInitial values(s) of the set.\n-- @returns\tSet\tA table of keys equal to true.\nfunction Set.new(i)",
"params": [
{
"directive": "param",
"text": "i\tany\tInitial values(s) of the set.",
"name": "i",
"type": "any",
"description": "Initial values(s) of the set."
}
],
"returns": {
"directive": "returns",
"text": "Set\tA table of keys equal to true.",
"type": "Set",
"description": "A table of keys equal to true."
},
"examples": [],
"name_full": "worldeditadditions_core.Set.new",
"filename": "worldeditadditions_core/utils/set.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/set.lua#L30-L33"
}
setting_handler 🔗
A wrapper to simultaneously handle global and world settings.
table 🔗
Functions that operate on tables. Lua doesn't exactly come with batteries included, so this is quite an extensive collection of functions :P
Functions
apply 🔗
SHALLOW ONLY - applies the values in source to overwrite the equivalent keys in target
. Warning: This function mutates target
!
Arguments
Name | Type | Default value | Description |
---|---|---|---|
source | table | nil | The source to take values from |
target | table | nil | The target to write values to |
Returns
nil
Source
--- SHALLOW ONLY - applies the values in source to overwrite the equivalent keys in `target`.
-- Warning: This function mutates `target`!
-- @param source table The source to take values from
-- @param target table The target to write values to
local function apply(source, target)
{
"type": "function",
"internal": false,
"description": "SHALLOW ONLY - applies the values in source to overwrite the equivalent keys in `target`.\nWarning: This function mutates `target`!",
"directives": [
{
"directive": "param",
"text": "source\ttable\tThe source to take values from",
"name": "source",
"type": "table",
"description": "The source to take values from"
},
{
"directive": "param",
"text": "target\ttable\tThe target to write values to",
"name": "target",
"type": "table",
"description": "The target to write values to"
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 7,
"name": "apply",
"instanced": false,
"args": [
"source",
"target"
],
"text": "--- SHALLOW ONLY - applies the values in source to overwrite the equivalent keys in `target`.\n-- Warning: This function mutates `target`!\n-- @param\tsource\ttable\tThe source to take values from\n-- @param\ttarget\ttable\tThe target to write values to\nlocal function apply(source, target)",
"params": [
{
"directive": "param",
"text": "source\ttable\tThe source to take values from",
"name": "source",
"type": "table",
"description": "The source to take values from"
},
{
"directive": "param",
"text": "target\ttable\tThe target to write values to",
"name": "target",
"type": "table",
"description": "The target to write values to"
}
],
"examples": [],
"name_full": "worldeditadditions_core.table.apply",
"filename": "worldeditadditions_core/utils/table/table_apply.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_apply.lua#L4-L8"
}
contains 🔗
Looks to see whether a given table contains a given value.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | The table to look in. |
target | any | nil | The target to look for. |
Returns
bool
:
Whether the table contains the given target or not.
Source
--- Looks to see whether a given table contains a given value.
-- @param tbl table The table to look in.
-- @param target any The target to look for.
-- @returns bool Whether the table contains the given target or not.
local function contains(tbl, target)
{
"type": "function",
"internal": false,
"description": "Looks to see whether a given table contains a given value.",
"directives": [
{
"directive": "param",
"text": "tbl\t\ttable\tThe table to look in.",
"name": "tbl",
"type": "table",
"description": "The table to look in."
},
{
"directive": "param",
"text": "target\tany\t\tThe target to look for.",
"name": "target",
"type": "any",
"description": "The target to look for."
},
{
"directive": "returns",
"text": "bool\tWhether the table contains the given target or not.",
"type": "bool",
"description": "Whether the table contains the given target or not."
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 7,
"name": "contains",
"instanced": false,
"args": [
"tbl",
"target"
],
"text": "--- Looks to see whether a given table contains a given value.\n-- @param\ttbl\t\ttable\tThe table to look in.\n-- @param\ttarget\tany\t\tThe target to look for.\n-- @returns\tbool\tWhether the table contains the given target or not.\nlocal function contains(tbl, target)",
"params": [
{
"directive": "param",
"text": "tbl\t\ttable\tThe table to look in.",
"name": "tbl",
"type": "table",
"description": "The table to look in."
},
{
"directive": "param",
"text": "target\tany\t\tThe target to look for.",
"name": "target",
"type": "any",
"description": "The target to look for."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the table contains the given target or not.",
"type": "bool",
"description": "Whether the table contains the given target or not."
},
"examples": [],
"name_full": "worldeditadditions_core.table.contains",
"filename": "worldeditadditions_core/utils/table/table_contains.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_contains.lua#L4-L8"
}
deepcopy 🔗
Deep clones a given table.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
obj | table | nil | The table to clone. |
Returns
table
:
A deep copy of the given table.
Source
--- Deep clones a given table.
-- @source https://gist.github.com/tylerneylon/81333721109155b2d244
-- @param obj table The table to clone.
-- @returns table A deep copy of the given table.
local function deepcopy(obj, seen)
{
"type": "function",
"internal": false,
"description": "Deep clones a given table.",
"directives": [
{
"directive": "source",
"text": "https://gist.github.com/tylerneylon/81333721109155b2d244"
},
{
"directive": "param",
"text": "obj\t\ttable\tThe table to clone.",
"name": "obj",
"type": "table",
"description": "The table to clone."
},
{
"directive": "returns",
"text": "table\tA deep copy of the given table.",
"type": "table",
"description": "A deep copy of the given table."
}
],
"line": 24,
"namespace": "worldeditadditions_core.table",
"line_last": 28,
"name": "deepcopy",
"instanced": false,
"args": [
"obj",
"seen"
],
"text": "--- Deep clones a given table.\n-- @source\thttps://gist.github.com/tylerneylon/81333721109155b2d244\n-- @param\tobj\t\ttable\tThe table to clone.\n-- @returns\ttable\tA deep copy of the given table.\nlocal function deepcopy(obj, seen)",
"params": [
{
"directive": "param",
"text": "obj\t\ttable\tThe table to clone.",
"name": "obj",
"type": "table",
"description": "The table to clone."
}
],
"returns": {
"directive": "returns",
"text": "table\tA deep copy of the given table.",
"type": "table",
"description": "A deep copy of the given table."
},
"examples": [],
"name_full": "worldeditadditions_core.table.deepcopy",
"filename": "worldeditadditions_core/utils/table/deepcopy.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/deepcopy.lua#L25-L29"
}
filter 🔗
Filters the items in the given table using the given function. The function is executed for each item in the list. If it returns true, the item is kept. If it returns false, the item is discarded. Arguments passed to the function: item, i ...where item is the item to filter, and i is the index in the table the item is located at.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | The table of values to filter. |
func | function<any, number>:bool | nil | The filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept |
Returns
table
:
A new table containing the values that the given function returned true for.
Source
--- Filters the items in the given table using the given function.
-- The function is executed for each item in the list. If it returns true, the
-- item is kept. If it returns false, the item is discarded.
-- Arguments passed to the function: item, i
-- ...where item is the item to filter, and i is the index in the table the item
-- is located at.
-- @param tbl table The table of values to filter.
-- @param func function<any, number>:bool The filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept
-- @returns table A new table containing the values that the given function returned true for.
local function filter(tbl, func)
{
"type": "function",
"internal": false,
"description": "Filters the items in the given table using the given function.\nThe function is executed for each item in the list. If it returns true, the\nitem is kept. If it returns false, the item is discarded.\nArguments passed to the function: item, i\n...where item is the item to filter, and i is the index in the table the item\nis located at.",
"directives": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table of values to filter.",
"name": "tbl",
"type": "table",
"description": "The table of values to filter."
},
{
"directive": "param",
"text": "func\tfunction<any, number>:bool\tThe filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept",
"name": "func",
"type": "function<any, number>:bool",
"description": "The filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept"
},
{
"directive": "returns",
"text": "table\tA new table containing the values that the given function returned true for.",
"type": "table",
"description": "A new table containing the values that the given function returned true for."
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 12,
"name": "filter",
"instanced": false,
"args": [
"tbl",
"func"
],
"text": "--- Filters the items in the given table using the given function.\n-- The function is executed for each item in the list. If it returns true, the\n-- item is kept. If it returns false, the item is discarded.\n-- Arguments passed to the function: item, i\n-- ...where item is the item to filter, and i is the index in the table the item\n-- is located at.\n-- @param\ttbl\t\ttable\t\tThe table of values to filter.\n-- @param\tfunc\tfunction<any, number>:bool\tThe filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept\n-- @returns\ttable\tA new table containing the values that the given function returned true for.\nlocal function filter(tbl, func)",
"params": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table of values to filter.",
"name": "tbl",
"type": "table",
"description": "The table of values to filter."
},
{
"directive": "param",
"text": "func\tfunction<any, number>:bool\tThe filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept",
"name": "func",
"type": "function<any, number>:bool",
"description": "The filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept"
}
],
"returns": {
"directive": "returns",
"text": "table\tA new table containing the values that the given function returned true for.",
"type": "table",
"description": "A new table containing the values that the given function returned true for."
},
"examples": [],
"name_full": "worldeditadditions_core.table.filter",
"filename": "worldeditadditions_core/utils/table/table_filter.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_filter.lua#L4-L13"
}
find 🔗
Finds the first element in the given table that satisfies the given testing function. A port of Javascript's array.find
to Lua.
Uses for .. in ipairs() under-the-hood.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | The table to search. |
func | function | nil | The testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:
|
Returns
any|nil The first element in the table that satisfies the predicate, or nil if no such element is found.
Source
--- Finds the first element in the given table that satisfies the given testing function.
-- A port of Javascript's `array.find` to Lua.
--
-- Uses for .. in ipairs() under-the-hood.
--
-- @param tbl table The table to search.
-- @param func function The testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:
-- 1. `value` (any): The value being inspected.
-- 2. `i` (number): The index in the table that the value can be found at
-- 3. `tbl` (table): The original table.
-- @return any|nil The first element in the table that satisfies the predicate, or nil if no such element is found.
local function find(tbl, func)
{
"type": "function",
"internal": false,
"description": "Finds the first element in the given table that satisfies the given testing function.\nA port of Javascript's `array.find` to Lua.\n\nUses for .. in ipairs() under-the-hood.\n",
"directives": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table to search.",
"name": "tbl",
"type": "table",
"description": "The table to search."
},
{
"directive": "param",
"text": "func\tfunction\tThe testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:\n1. `value` (any): The value being inspected.\n2. `i` (number): The index in the table that the value can be found at\n3. `tbl` (table): The original table.",
"name": "func",
"type": "function",
"description": "The testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:\n1. `value` (any): The value being inspected.\n2. `i` (number): The index in the table that the value can be found at\n3. `tbl` (table): The original table."
},
{
"directive": "returns",
"text": "any|nil The first element in the table that satisfies the predicate, or nil if no such element is found.",
"type": "any|nil The first element in the table that satisfies the predicate, or nil if no such element is found."
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 14,
"name": "find",
"instanced": false,
"args": [
"tbl",
"func"
],
"text": "--- Finds the first element in the given table that satisfies the given testing function.\n-- A port of Javascript's `array.find` to Lua.\n-- \n-- Uses for .. in ipairs() under-the-hood.\n-- \n-- @param\ttbl\t\ttable\t\tThe table to search.\n-- @param\tfunc\tfunction\tThe testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:\n-- 1. `value` (any): The value being inspected.\n-- 2. `i` (number): The index in the table that the value can be found at\n-- 3. `tbl` (table): The original table.\n-- @return any|nil The first element in the table that satisfies the predicate, or nil if no such element is found.\nlocal function find(tbl, func)",
"params": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table to search.",
"name": "tbl",
"type": "table",
"description": "The table to search."
},
{
"directive": "param",
"text": "func\tfunction\tThe testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:\n1. `value` (any): The value being inspected.\n2. `i` (number): The index in the table that the value can be found at\n3. `tbl` (table): The original table.",
"name": "func",
"type": "function",
"description": "The testing function to call on each element. The function should return true/false as to whether the passed value passes the test function. The testing function will be provided with the following arguments:\n1. `value` (any): The value being inspected.\n2. `i` (number): The index in the table that the value can be found at\n3. `tbl` (table): The original table."
}
],
"returns": {
"directive": "returns",
"text": "any|nil The first element in the table that satisfies the predicate, or nil if no such element is found.",
"type": "any|nil The first element in the table that satisfies the predicate, or nil if no such element is found."
},
"examples": [],
"name_full": "worldeditadditions_core.table.find",
"filename": "worldeditadditions_core/utils/table/table_find.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_find.lua#L4-L15"
}
get_last 🔗
Returns only the last count items in a given numerical table-based list.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | The table to fetch items from. |
count | number | nil | The number of items to fetch from the end of the table. |
Returns
table
:
A table containing the last count items from the given table.
Source
--- Returns only the last count items in a given numerical table-based list.
-- @param tbl table The table to fetch items from.
-- @param count number The number of items to fetch from the end of the table.
-- @returns table A table containing the last count items from the given table.
local function get_last(tbl, count)
{
"type": "function",
"internal": false,
"description": "Returns only the last count items in a given numerical table-based list.",
"directives": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table to fetch items from.",
"name": "tbl",
"type": "table",
"description": "The table to fetch items from."
},
{
"directive": "param",
"text": "count\tnumber\t\tThe number of items to fetch from the end of the table.",
"name": "count",
"type": "number",
"description": "The number of items to fetch from the end of the table."
},
{
"directive": "returns",
"text": "table\tA table containing the last count items from the given table.",
"type": "table",
"description": "A table containing the last count items from the given table."
}
],
"line": 7,
"namespace": "worldeditadditions_core.table",
"line_last": 11,
"name": "get_last",
"instanced": false,
"args": [
"tbl",
"count"
],
"text": "--- Returns only the last count items in a given numerical table-based list.\n-- @param\ttbl\t\ttable\t\tThe table to fetch items from.\n-- @param\tcount\tnumber\t\tThe number of items to fetch from the end of the table.\n-- @returns\ttable\tA table containing the last count items from the given table.\nlocal function get_last(tbl, count)",
"params": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table to fetch items from.",
"name": "tbl",
"type": "table",
"description": "The table to fetch items from."
},
{
"directive": "param",
"text": "count\tnumber\t\tThe number of items to fetch from the end of the table.",
"name": "count",
"type": "number",
"description": "The number of items to fetch from the end of the table."
}
],
"returns": {
"directive": "returns",
"text": "table\tA table containing the last count items from the given table.",
"type": "table",
"description": "A table containing the last count items from the given table."
},
"examples": [],
"name_full": "worldeditadditions_core.table.get_last",
"filename": "worldeditadditions_core/utils/table/table_get_last.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_get_last.lua#L8-L12"
}
makeset 🔗
Creates a table that stores data in keys. See also worldeditadditions_core.Set
.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
list | table | nil | The table of values to convert to keys. |
Returns
table
:
The table of (key => true) pairs.
Source
--- Creates a table that stores data in keys.
-- See also `worldeditadditions_core.Set`.
-- @source https://riptutorial.com/lua/example/13407/search-for-an-item-in-a-list
-- @param list table The table of values to convert to keys.
-- @return table The table of (key => true) pairs.
local function makeset(list)
{
"type": "function",
"internal": false,
"description": "Creates a table that stores data in keys.\nSee also `worldeditadditions_core.Set`.",
"directives": [
{
"directive": "source",
"text": "https://riptutorial.com/lua/example/13407/search-for-an-item-in-a-list"
},
{
"directive": "param",
"text": "list\ttable\tThe table of values to convert to keys.",
"name": "list",
"type": "table",
"description": "The table of values to convert to keys."
},
{
"directive": "returns",
"text": "table\tThe table of (key => true) pairs.",
"type": "table",
"description": "The table of (key => true) pairs."
}
],
"line": 4,
"namespace": "worldeditadditions_core.table",
"line_last": 9,
"name": "makeset",
"instanced": false,
"args": [
"list"
],
"text": "--- Creates a table that stores data in keys.\n-- See also `worldeditadditions_core.Set`.\n-- @source\thttps://riptutorial.com/lua/example/13407/search-for-an-item-in-a-list\n-- @param\tlist\ttable\tThe table of values to convert to keys.\n-- @return\ttable\tThe table of (key => true) pairs.\nlocal function makeset(list)",
"params": [
{
"directive": "param",
"text": "list\ttable\tThe table of values to convert to keys.",
"name": "list",
"type": "table",
"description": "The table of values to convert to keys."
}
],
"returns": {
"directive": "returns",
"text": "table\tThe table of (key => true) pairs.",
"type": "table",
"description": "The table of (key => true) pairs."
},
"examples": [],
"name_full": "worldeditadditions_core.table.makeset",
"filename": "worldeditadditions_core/utils/table/makeset.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/makeset.lua#L5-L10"
}
map 🔗
Executes the given function on every item in the given table. Ignores return values that are nil and doesn't insert them into the table.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | The table to operate on. |
func | function<any>:any|nil | nil | The function to execute on every item in the table. |
Returns
table
:
A new table containing the return values of the function.
Source
--- Executes the given function on every item in the given table.
-- Ignores return values that are nil and doesn't insert them into the table.
-- @param tbl table The table to operate on.
-- @param func function<any>:any|nil The function to execute on every item in the table.
-- @returns table A new table containing the return values of the function.
local function map(tbl, func)
{
"type": "function",
"internal": false,
"description": "Executes the given function on every item in the given table.\nIgnores return values that are nil and doesn't insert them into the table.",
"directives": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table to operate on.",
"name": "tbl",
"type": "table",
"description": "The table to operate on."
},
{
"directive": "param",
"text": "func\tfunction<any>:any|nil\tThe function to execute on every item in the table.",
"name": "func",
"type": "function<any>:any|nil",
"description": "The function to execute on every item in the table."
},
{
"directive": "returns",
"text": "table\tA new table containing the return values of the function.",
"type": "table",
"description": "A new table containing the return values of the function."
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 8,
"name": "map",
"instanced": false,
"args": [
"tbl",
"func"
],
"text": "--- Executes the given function on every item in the given table.\n-- Ignores return values that are nil and doesn't insert them into the table.\n-- @param\ttbl\t\ttable\t\tThe table to operate on.\n-- @param\tfunc\tfunction<any>:any|nil\tThe function to execute on every item in the table.\n-- @returns\ttable\tA new table containing the return values of the function.\nlocal function map(tbl, func)",
"params": [
{
"directive": "param",
"text": "tbl\t\ttable\t\tThe table to operate on.",
"name": "tbl",
"type": "table",
"description": "The table to operate on."
},
{
"directive": "param",
"text": "func\tfunction<any>:any|nil\tThe function to execute on every item in the table.",
"name": "func",
"type": "function<any>:any|nil",
"description": "The function to execute on every item in the table."
}
],
"returns": {
"directive": "returns",
"text": "table\tA new table containing the return values of the function.",
"type": "table",
"description": "A new table containing the return values of the function."
},
"examples": [],
"name_full": "worldeditadditions_core.table.map",
"filename": "worldeditadditions_core/utils/table/table_map.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_map.lua#L4-L9"
}
reduce 🔗
Lua implementation of array.reduce()
from Javascript.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | The table to iterate over. | nil | |
func | The function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments. | nil | |
initial_value | The initial value of the accumulator. | nil |
Returns
nil
Source
--- Lua implementation of `array.reduce()` from Javascript.
-- @param tbl The table to iterate over.
-- @param func The function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments.
-- @param initial_value The initial value of the accumulator.
local function reduce(tbl, func, initial_value)
{
"type": "function",
"internal": false,
"description": "Lua implementation of `array.reduce()` from Javascript.",
"directives": [
{
"directive": "param",
"text": "tbl\t\t\t\tThe table to iterate over.",
"name": "tbl",
"type": "The table to iterate over."
},
{
"directive": "param",
"text": "func\t\t\tThe function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments.",
"name": "func",
"type": "The function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments."
},
{
"directive": "param",
"text": "initial_value\tThe initial value of the accumulator.",
"name": "initial_value",
"type": "The initial value of the accumulator."
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 7,
"name": "reduce",
"instanced": false,
"args": [
"tbl",
"func",
"initial_value"
],
"text": "--- Lua implementation of `array.reduce()` from Javascript.\n-- @param\ttbl\t\t\t\tThe table to iterate over.\n-- @param\tfunc\t\t\tThe function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments.\n-- @param\tinitial_value\tThe initial value of the accumulator.\nlocal function reduce(tbl, func, initial_value)",
"params": [
{
"directive": "param",
"text": "tbl\t\t\t\tThe table to iterate over.",
"name": "tbl",
"type": "The table to iterate over."
},
{
"directive": "param",
"text": "func\t\t\tThe function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments.",
"name": "func",
"type": "The function to call for every element in tbl. Will be passed the following arguments: accumulator, value, index, table. Of course, the provided function need not take this many arguments."
},
{
"directive": "param",
"text": "initial_value\tThe initial value of the accumulator.",
"name": "initial_value",
"type": "The initial value of the accumulator."
}
],
"examples": [],
"name_full": "worldeditadditions_core.table.reduce",
"filename": "worldeditadditions_core/utils/table/table_reduce.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_reduce.lua#L4-L8"
}
shallowcopy 🔗
Shallow clones a table.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
orig | table | nil | The table to clone. |
Returns
table
:
The cloned table.
Source
--- Shallow clones a table.
-- @source http://lua-users.org/wiki/CopyTable
-- @param orig table The table to clone.
-- @return table The cloned table.
local function shallowcopy(orig)
{
"type": "function",
"internal": false,
"description": "Shallow clones a table.",
"directives": [
{
"directive": "source",
"text": "http://lua-users.org/wiki/CopyTable"
},
{
"directive": "param",
"text": "orig\ttable\tThe table to clone.",
"name": "orig",
"type": "table",
"description": "The table to clone."
},
{
"directive": "returns",
"text": "table\tThe cloned table.",
"type": "table",
"description": "The cloned table."
}
],
"line": 4,
"namespace": "worldeditadditions_core.table",
"line_last": 8,
"name": "shallowcopy",
"instanced": false,
"args": [
"orig"
],
"text": "--- Shallow clones a table.\n-- @source\thttp://lua-users.org/wiki/CopyTable\n-- @param\torig\ttable\tThe table to clone.\n-- @return\ttable\tThe cloned table.\nlocal function shallowcopy(orig)",
"params": [
{
"directive": "param",
"text": "orig\ttable\tThe table to clone.",
"name": "orig",
"type": "table",
"description": "The table to clone."
}
],
"returns": {
"directive": "returns",
"text": "table\tThe cloned table.",
"type": "table",
"description": "The cloned table."
},
"examples": [],
"name_full": "worldeditadditions_core.table.shallowcopy",
"filename": "worldeditadditions_core/utils/table/shallowcopy.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/shallowcopy.lua#L5-L9"
}
tostring 🔗
Returns the key value pairs in a table as a single string
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | input table |
sep | string | nil | key value separator |
new_line | string | nil | key value pair delimiter |
max_depth | number | nil | max recursion depth (optional) |
Returns
string
:
concatenated table pairs
Source
--- Returns the key value pairs in a table as a single string
-- @param tbl table input table
-- @param sep string key value separator
-- @param new_line string key value pair delimiter
-- @param max_depth number max recursion depth (optional)
-- @return string concatenated table pairs
local function tostring(tbl, sep, new_line, max_depth)
{
"type": "function",
"internal": false,
"description": "Returns the key value pairs in a table as a single string",
"directives": [
{
"directive": "param",
"text": "tbl\ttable\tinput table",
"name": "tbl",
"type": "table",
"description": "input table"
},
{
"directive": "param",
"text": "sep\tstring\tkey value separator",
"name": "sep",
"type": "string",
"description": "key value separator"
},
{
"directive": "param",
"text": "new_line\tstring\tkey value pair delimiter",
"name": "new_line",
"type": "string",
"description": "key value pair delimiter"
},
{
"directive": "param",
"text": "max_depth\tnumber\tmax recursion depth (optional)",
"name": "max_depth",
"type": "number",
"description": "max recursion depth (optional)"
},
{
"directive": "returns",
"text": "string\tconcatenated table pairs",
"type": "string",
"description": "concatenated table pairs"
}
],
"line": 3,
"namespace": "worldeditadditions_core.table",
"line_last": 9,
"name": "tostring",
"instanced": false,
"args": [
"tbl",
"sep",
"new_line",
"max_depth"
],
"text": "--- Returns the key value pairs in a table as a single string\n-- @param\ttbl\ttable\tinput table\n-- @param\tsep\tstring\tkey value separator\n-- @param\tnew_line\tstring\tkey value pair delimiter\n-- @param\tmax_depth\tnumber\tmax recursion depth (optional)\n-- @return\tstring\tconcatenated table pairs\nlocal function tostring(tbl, sep, new_line, max_depth)",
"params": [
{
"directive": "param",
"text": "tbl\ttable\tinput table",
"name": "tbl",
"type": "table",
"description": "input table"
},
{
"directive": "param",
"text": "sep\tstring\tkey value separator",
"name": "sep",
"type": "string",
"description": "key value separator"
},
{
"directive": "param",
"text": "new_line\tstring\tkey value pair delimiter",
"name": "new_line",
"type": "string",
"description": "key value pair delimiter"
},
{
"directive": "param",
"text": "max_depth\tnumber\tmax recursion depth (optional)",
"name": "max_depth",
"type": "number",
"description": "max recursion depth (optional)"
}
],
"returns": {
"directive": "returns",
"text": "string\tconcatenated table pairs",
"type": "string",
"description": "concatenated table pairs"
},
"examples": [],
"name_full": "worldeditadditions_core.table.tostring",
"filename": "worldeditadditions_core/utils/table/table_tostring.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_tostring.lua#L4-L10"
}
unique 🔗
Builds a new table with the elements of the given table appearing at most once. See also worldeditadditions_core.Set
.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | table | nil | The table of values to make unique. |
Returns
table
:
A new table containing the values of the given table appearing at most once.
Source
--- Builds a new table with the elements of the given table appearing at most once.
-- See also `worldeditadditions_core.Set`.
-- @param tbl table The table of values to make unique.
-- @returns table A new table containing the values of the given table appearing at most once.
local function unique(tbl)
{
"type": "function",
"internal": false,
"description": "Builds a new table with the elements of the given table appearing at most once.\nSee also `worldeditadditions_core.Set`.",
"directives": [
{
"directive": "param",
"text": "tbl\t\ttable\tThe table of values to make unique.",
"name": "tbl",
"type": "table",
"description": "The table of values to make unique."
},
{
"directive": "returns",
"text": "table\tA new table containing the values of the given table appearing at most once.",
"type": "table",
"description": "A new table containing the values of the given table appearing at most once."
}
],
"line": 4,
"namespace": "worldeditadditions_core.table",
"line_last": 8,
"name": "unique",
"instanced": false,
"args": [
"tbl"
],
"text": "--- Builds a new table with the elements of the given table appearing at most once.\n-- See also `worldeditadditions_core.Set`.\n-- @param\ttbl\t\ttable\tThe table of values to make unique.\n-- @returns\ttable\tA new table containing the values of the given table appearing at most once.\nlocal function unique(tbl)",
"params": [
{
"directive": "param",
"text": "tbl\t\ttable\tThe table of values to make unique.",
"name": "tbl",
"type": "table",
"description": "The table of values to make unique."
}
],
"returns": {
"directive": "returns",
"text": "table\tA new table containing the values of the given table appearing at most once.",
"type": "table",
"description": "A new table containing the values of the given table appearing at most once."
},
"examples": [],
"name_full": "worldeditadditions_core.table.unique",
"filename": "worldeditadditions_core/utils/table/table_unique.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/table/table_unique.lua#L5-L9"
}
terrain 🔗
Functions for working with 2D terrain maps.
Functions
apply_heightmap_changes 🔗
Applies changes to a heightmap to a Voxel Manipulator data block.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | vector | nil | Position 1 of the defined region |
pos2 | vector | nil | Position 2 of the defined region |
area | VoxelArea | nil | The VoxelArea object (see worldedit.manip_helpers.init) |
data | number[] | nil | The node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator. |
heightmap_old | number[] | nil | The original heightmap from worldeditadditions.make_heightmap. |
heightmap_new | number[] | nil | The new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work. |
heightmap_size | vector | nil | The x / z size of the heightmap. Any y value set in the vector is ignored. |
Returns
bool, string|{ added: number, removed: number }
:
A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).
Source
--- Applies changes to a heightmap to a Voxel Manipulator data block.
-- @param pos1 vector Position 1 of the defined region
-- @param pos2 vector Position 2 of the defined region
-- @param area VoxelArea The VoxelArea object (see worldedit.manip_helpers.init)
-- @param data number[] The node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator.
-- @param heightmap_old number[] The original heightmap from worldeditadditions.make_heightmap.
-- @param heightmap_new number[] The new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work.
-- @param heightmap_size vector The x / z size of the heightmap. Any y value set in the vector is ignored.
-- @returns bool, string|{ added: number, removed: number } A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).
local function apply_heightmap_changes(pos1, pos2, area, data, heightmap_old, heightmap_new, heightmap_size)
{
"type": "function",
"internal": false,
"description": "Applies changes to a heightmap to a Voxel Manipulator data block.",
"directives": [
{
"directive": "param",
"text": "pos1\tvector\t\tPosition 1 of the defined region",
"name": "pos1",
"type": "vector",
"description": "Position 1 of the defined region"
},
{
"directive": "param",
"text": "pos2\tvector\t\tPosition 2 of the defined region",
"name": "pos2",
"type": "vector",
"description": "Position 2 of the defined region"
},
{
"directive": "param",
"text": "area\tVoxelArea\tThe VoxelArea object (see worldedit.manip_helpers.init)",
"name": "area",
"type": "VoxelArea",
"description": "The VoxelArea object (see worldedit.manip_helpers.init)"
},
{
"directive": "param",
"text": "data\tnumber[]\tThe node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator.",
"name": "data",
"type": "number[]",
"description": "The node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator."
},
{
"directive": "param",
"text": "heightmap_old\tnumber[]\tThe original heightmap from worldeditadditions.make_heightmap.",
"name": "heightmap_old",
"type": "number[]",
"description": "The original heightmap from worldeditadditions.make_heightmap."
},
{
"directive": "param",
"text": "heightmap_new\tnumber[]\tThe new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work.",
"name": "heightmap_new",
"type": "number[]",
"description": "The new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work."
},
{
"directive": "param",
"text": "heightmap_size\tvector\tThe x / z size of the heightmap. Any y value set in the vector is ignored.",
"name": "heightmap_size",
"type": "vector",
"description": "The x / z size of the heightmap. Any y value set in the vector is ignored."
},
{
"directive": "returns",
"text": "bool, string|{ added: number, removed: number }\tA bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).",
"type": "bool, string|{ added: number, removed: number }",
"description": "A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful)."
}
],
"line": 7,
"namespace": "worldeditadditions_core.terrain",
"line_last": 16,
"name": "apply_heightmap_changes",
"instanced": false,
"args": [
"pos1",
"pos2",
"area",
"data",
"heightmap_old",
"heightmap_new",
"heightmap_size"
],
"text": "--- Applies changes to a heightmap to a Voxel Manipulator data block.\n-- @param\tpos1\tvector\t\tPosition 1 of the defined region\n-- @param\tpos2\tvector\t\tPosition 2 of the defined region\n-- @param\tarea\tVoxelArea\tThe VoxelArea object (see worldedit.manip_helpers.init)\n-- @param\tdata\tnumber[]\tThe node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator.\n-- @param\theightmap_old\tnumber[]\tThe original heightmap from worldeditadditions.make_heightmap.\n-- @param\theightmap_new\tnumber[]\tThe new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work.\n-- @param\theightmap_size\tvector\tThe x / z size of the heightmap. Any y value set in the vector is ignored.\n-- @returns\tbool, string|{ added: number, removed: number }\tA bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).\nlocal function apply_heightmap_changes(pos1, pos2, area, data, heightmap_old, heightmap_new, heightmap_size)",
"params": [
{
"directive": "param",
"text": "pos1\tvector\t\tPosition 1 of the defined region",
"name": "pos1",
"type": "vector",
"description": "Position 1 of the defined region"
},
{
"directive": "param",
"text": "pos2\tvector\t\tPosition 2 of the defined region",
"name": "pos2",
"type": "vector",
"description": "Position 2 of the defined region"
},
{
"directive": "param",
"text": "area\tVoxelArea\tThe VoxelArea object (see worldedit.manip_helpers.init)",
"name": "area",
"type": "VoxelArea",
"description": "The VoxelArea object (see worldedit.manip_helpers.init)"
},
{
"directive": "param",
"text": "data\tnumber[]\tThe node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator.",
"name": "data",
"type": "number[]",
"description": "The node ids data array containing the slice of the Minetest world extracted using the Voxel Manipulator."
},
{
"directive": "param",
"text": "heightmap_old\tnumber[]\tThe original heightmap from worldeditadditions.make_heightmap.",
"name": "heightmap_old",
"type": "number[]",
"description": "The original heightmap from worldeditadditions.make_heightmap."
},
{
"directive": "param",
"text": "heightmap_new\tnumber[]\tThe new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work.",
"name": "heightmap_new",
"type": "number[]",
"description": "The new heightmap containing the altered updated values. It is expected that worldeditadditions.table.shallowcopy be used to make a COPY of the data worldeditadditions.make_heightmap for this purpose. Both heightmap_old AND heightmap_new are REQUIRED in order for this function to work."
},
{
"directive": "param",
"text": "heightmap_size\tvector\tThe x / z size of the heightmap. Any y value set in the vector is ignored.",
"name": "heightmap_size",
"type": "vector",
"description": "The x / z size of the heightmap. Any y value set in the vector is ignored."
}
],
"returns": {
"directive": "returns",
"text": "bool, string|{ added: number, removed: number }\tA bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful).",
"type": "bool, string|{ added: number, removed: number }",
"description": "A bool indicating whether the operation was successful or not, followed by either an error message as a string (if it was not successful) or a table of statistics (if it was successful)."
},
"examples": [],
"name_full": "worldeditadditions_core.terrain.apply_heightmap_changes",
"filename": "worldeditadditions_core/utils/terrain/apply_heightmap_changes.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/terrain/apply_heightmap_changes.lua#L8-L17"
}
calculate_normals 🔗
Calculates a normal map for the given heightmap. Caution: This method (like worldeditadditions.make_heightmap) works on X AND Z, and NOT x and y. This means that the resulting 3d normal vectors will have the z and y values swapped.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
heightmap | table | nil | A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap(). |
heightmap_size | int[] | nil | The size of the heightmap in the form [ z, x ] |
Returns
Vector[]
:
The calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal.
Source
--- Calculates a normal map for the given heightmap.
-- Caution: This method (like worldeditadditions.make_heightmap) works on
-- X AND Z, and NOT x and y. This means that the resulting 3d normal vectors
-- will have the z and y values swapped.
-- @param heightmap table A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().
-- @param heightmap_size int[] The size of the heightmap in the form [ z, x ]
-- @return Vector[] The calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal.
local function calculate_normals(heightmap, heightmap_size)
{
"type": "function",
"internal": false,
"description": "Calculates a normal map for the given heightmap.\nCaution: This method (like worldeditadditions.make_heightmap) works on\nX AND Z, and NOT x and y. This means that the resulting 3d normal vectors\nwill have the z and y values swapped.",
"directives": [
{
"directive": "param",
"text": "heightmap\t\ttable\tA ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().",
"name": "heightmap",
"type": "table",
"description": "A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap()."
},
{
"directive": "param",
"text": "heightmap_size\tint[]\tThe size of the heightmap in the form [ z, x ]",
"name": "heightmap_size",
"type": "int[]",
"description": "The size of the heightmap in the form [ z, x ]"
},
{
"directive": "returns",
"text": "Vector[]\t\tThe calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal.",
"type": "Vector[]",
"description": "The calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal."
}
],
"line": 6,
"namespace": "worldeditadditions_core.terrain",
"line_last": 13,
"name": "calculate_normals",
"instanced": false,
"args": [
"heightmap",
"heightmap_size"
],
"text": "--- Calculates a normal map for the given heightmap.\n-- Caution: This method (like worldeditadditions.make_heightmap) works on\n-- X AND Z, and NOT x and y. This means that the resulting 3d normal vectors\n-- will have the z and y values swapped.\n-- @param\theightmap\t\ttable\tA ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().\n-- @param\theightmap_size\tint[]\tThe size of the heightmap in the form [ z, x ]\n-- @return\tVector[]\t\tThe calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal.\nlocal function calculate_normals(heightmap, heightmap_size)",
"params": [
{
"directive": "param",
"text": "heightmap\t\ttable\tA ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().",
"name": "heightmap",
"type": "table",
"description": "A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap()."
},
{
"directive": "param",
"text": "heightmap_size\tint[]\tThe size of the heightmap in the form [ z, x ]",
"name": "heightmap_size",
"type": "int[]",
"description": "The size of the heightmap in the form [ z, x ]"
}
],
"returns": {
"directive": "returns",
"text": "Vector[]\t\tThe calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal.",
"type": "Vector[]",
"description": "The calculated normal map, in the same form as the input heightmap. Each element of the array is a Vector3 instance representing a normal."
},
"examples": [],
"name_full": "worldeditadditions_core.terrain.calculate_normals",
"filename": "worldeditadditions_core/utils/terrain/calculate_normals.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/terrain/calculate_normals.lua#L7-L14"
}
calculate_slopes 🔗
Converts a 2d heightmap into slope values in radians. Convert a radians to degrees by doing (radians*math.pi) / 180 for display, but it is STRONGLY recommended to keep all internal calculations in radians.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
heightmap | table | nil | A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap(). |
heightmap_size | int[] | nil | The size of the heightmap in the form [ z, x ] |
Returns
Vector[]
:
The calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians.
Source
--- Converts a 2d heightmap into slope values in radians.
-- Convert a radians to degrees by doing (radians*math.pi) / 180 for display,
-- but it is STRONGLY recommended to keep all internal calculations in radians.
-- @param heightmap table A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().
-- @param heightmap_size int[] The size of the heightmap in the form [ z, x ]
-- @return Vector[] The calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians.
local function calculate_slopes(heightmap, heightmap_size)
{
"type": "function",
"internal": false,
"description": "Converts a 2d heightmap into slope values in radians.\nConvert a radians to degrees by doing (radians*math.pi) / 180 for display,\nbut it is STRONGLY recommended to keep all internal calculations in radians.",
"directives": [
{
"directive": "param",
"text": "heightmap\t\ttable\tA ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().",
"name": "heightmap",
"type": "table",
"description": "A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap()."
},
{
"directive": "param",
"text": "heightmap_size\tint[]\tThe size of the heightmap in the form [ z, x ]",
"name": "heightmap_size",
"type": "int[]",
"description": "The size of the heightmap in the form [ z, x ]"
},
{
"directive": "returns",
"text": "Vector[]\t\tThe calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians.",
"type": "Vector[]",
"description": "The calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians."
}
],
"line": 6,
"namespace": "worldeditadditions_core.terrain",
"line_last": 12,
"name": "calculate_slopes",
"instanced": false,
"args": [
"heightmap",
"heightmap_size"
],
"text": "--- Converts a 2d heightmap into slope values in radians.\n-- Convert a radians to degrees by doing (radians*math.pi) / 180 for display,\n-- but it is STRONGLY recommended to keep all internal calculations in radians.\n-- @param\theightmap\t\ttable\tA ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().\n-- @param\theightmap_size\tint[]\tThe size of the heightmap in the form [ z, x ]\n-- @return\tVector[]\t\tThe calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians.\nlocal function calculate_slopes(heightmap, heightmap_size)",
"params": [
{
"directive": "param",
"text": "heightmap\t\ttable\tA ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap().",
"name": "heightmap",
"type": "table",
"description": "A ZERO indexed flat heightmap. See worldeditadditions.terrain.make_heightmap()."
},
{
"directive": "param",
"text": "heightmap_size\tint[]\tThe size of the heightmap in the form [ z, x ]",
"name": "heightmap_size",
"type": "int[]",
"description": "The size of the heightmap in the form [ z, x ]"
}
],
"returns": {
"directive": "returns",
"text": "Vector[]\t\tThe calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians.",
"type": "Vector[]",
"description": "The calculated slope map, in the same form as the input heightmap. Each element of the array is a (floating-point) number representing the slope in that cell in radians."
},
"examples": [],
"name_full": "worldeditadditions_core.terrain.calculate_slopes",
"filename": "worldeditadditions_core/utils/terrain/calculate_slopes.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/terrain/calculate_slopes.lua#L7-L13"
}
make_heightmap 🔗
Given a manip object and associates, generates a 2D x/z heightmap. Note that pos1 and pos2 should have already been pushed through worldedit.sort_pos(pos1, pos2) before passing them to this function.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector | nil | Position 1 of the region to operate on |
pos2 | Vector | nil | Position 2 of the region to operate on |
manip | VoxelManip | nil | The VoxelManip object. |
area | area | nil | The associated area object. |
data | table | nil | The associated data object. |
Returns
table,table
:
The ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }.
Source
--- Given a manip object and associates, generates a 2D x/z heightmap.
-- Note that pos1 and pos2 should have already been pushed through
-- worldedit.sort_pos(pos1, pos2) before passing them to this function.
-- @param pos1 Vector Position 1 of the region to operate on
-- @param pos2 Vector Position 2 of the region to operate on
-- @param manip VoxelManip The VoxelManip object.
-- @param area area The associated area object.
-- @param data table The associated data object.
-- @return table,table The ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }.
local function make_heightmap(pos1, pos2, manip, area, data)
{
"type": "function",
"internal": false,
"description": "Given a manip object and associates, generates a 2D x/z heightmap.\nNote that pos1 and pos2 should have already been pushed through\nworldedit.sort_pos(pos1, pos2) before passing them to this function.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector\t\tPosition 1 of the region to operate on",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the region to operate on"
},
{
"directive": "param",
"text": "pos2\tVector\t\tPosition 2 of the region to operate on",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the region to operate on"
},
{
"directive": "param",
"text": "manip\tVoxelManip\tThe VoxelManip object.",
"name": "manip",
"type": "VoxelManip",
"description": "The VoxelManip object."
},
{
"directive": "param",
"text": "area\tarea\t\tThe associated area object.",
"name": "area",
"type": "area",
"description": "The associated area object."
},
{
"directive": "param",
"text": "data\ttable\t\tThe associated data object.",
"name": "data",
"type": "table",
"description": "The associated data object."
},
{
"directive": "returns",
"text": "table,table\t\t\tThe ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }.",
"type": "table,table",
"description": "The ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }."
}
],
"line": 6,
"namespace": "worldeditadditions_core.terrain",
"line_last": 15,
"name": "make_heightmap",
"instanced": false,
"args": [
"pos1",
"pos2",
"manip",
"area",
"data"
],
"text": "--- Given a manip object and associates, generates a 2D x/z heightmap.\n-- Note that pos1 and pos2 should have already been pushed through\n-- worldedit.sort_pos(pos1, pos2) before passing them to this function.\n-- @param\tpos1\tVector\t\tPosition 1 of the region to operate on\n-- @param\tpos2\tVector\t\tPosition 2 of the region to operate on\n-- @param\tmanip\tVoxelManip\tThe VoxelManip object.\n-- @param\tarea\tarea\t\tThe associated area object.\n-- @param\tdata\ttable\t\tThe associated data object.\n-- @return\ttable,table\t\t\tThe ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }.\nlocal function make_heightmap(pos1, pos2, manip, area, data)",
"params": [
{
"directive": "param",
"text": "pos1\tVector\t\tPosition 1 of the region to operate on",
"name": "pos1",
"type": "Vector",
"description": "Position 1 of the region to operate on"
},
{
"directive": "param",
"text": "pos2\tVector\t\tPosition 2 of the region to operate on",
"name": "pos2",
"type": "Vector",
"description": "Position 2 of the region to operate on"
},
{
"directive": "param",
"text": "manip\tVoxelManip\tThe VoxelManip object.",
"name": "manip",
"type": "VoxelManip",
"description": "The VoxelManip object."
},
{
"directive": "param",
"text": "area\tarea\t\tThe associated area object.",
"name": "area",
"type": "area",
"description": "The associated area object."
},
{
"directive": "param",
"text": "data\ttable\t\tThe associated data object.",
"name": "data",
"type": "table",
"description": "The associated data object."
}
],
"returns": {
"directive": "returns",
"text": "table,table\t\t\tThe ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }.",
"type": "table,table",
"description": "The ZERO-indexed heightmap data (as 1 single flat array), followed by the size of the heightmap in the form { z = size_z, x = size_x }."
},
"examples": [],
"name_full": "worldeditadditions_core.terrain.make_heightmap",
"filename": "worldeditadditions_core/utils/terrain/make_heightmap.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/terrain/make_heightmap.lua#L7-L16"
}
Vector3 🔗
A 3-dimensional vector.
Functions
abs 🔗
Returns the absolute form of this vector. In other words, it removes the minus sign from all components of the vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
The absolute form of the given vector.
Source
--- Returns the absolute form of this vector.
-- In other words, it removes the minus sign from all components of the vector.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 The absolute form of the given vector.
function Vector3.abs(a)
{
"type": "function",
"internal": false,
"description": "Returns the absolute form of this vector.\nIn other words, it removes the minus sign from all components of the vector.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tThe absolute form of the given vector.",
"type": "Vector3",
"description": "The absolute form of the given vector."
}
],
"line": 268,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 272,
"name": "abs",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns the absolute form of this vector.\n-- In other words, it removes the minus sign from all components of the vector.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tThe absolute form of the given vector.\nfunction Vector3.abs(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tThe absolute form of the given vector.",
"type": "Vector3",
"description": "The absolute form of the given vector."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.abs",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L269-L273"
}
add 🔗
Adds the specified vectors or numbers together. Returns the result as a new vector. If 1 of the inputs is a number and the other a vector, then the number will be added to each of the components of the vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3|number | nil | The first item to add. |
a | Vector3|number | nil | The second item to add. |
Returns
Vector3
:
The result as a new Vector3 object.
Source
--- Adds the specified vectors or numbers together.
-- Returns the result as a new vector.
-- If 1 of the inputs is a number and the other a vector, then the number will
-- be added to each of the components of the vector.
-- @param a Vector3|number The first item to add.
-- @param a Vector3|number The second item to add.
-- @returns Vector3 The result as a new Vector3 object.
function Vector3.add(a, b)
{
"type": "function",
"internal": false,
"description": "Adds the specified vectors or numbers together.\nReturns the result as a new vector.\nIf 1 of the inputs is a number and the other a vector, then the number will\nbe added to each of the components of the vector.",
"directives": [
{
"directive": "param",
"text": "a\tVector3|number\tThe first item to add.",
"name": "a",
"type": "Vector3|number",
"description": "The first item to add."
},
{
"directive": "param",
"text": "a\tVector3|number\tThe second item to add.",
"name": "a",
"type": "Vector3|number",
"description": "The second item to add."
},
{
"directive": "returns",
"text": "Vector3\t\t\t\tThe result as a new Vector3 object.",
"type": "Vector3",
"description": "The result as a new Vector3 object."
}
],
"line": 31,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 38,
"name": "add",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Adds the specified vectors or numbers together.\n-- Returns the result as a new vector.\n-- If 1 of the inputs is a number and the other a vector, then the number will\n-- be added to each of the components of the vector.\n-- @param\ta\tVector3|number\tThe first item to add.\n-- @param\ta\tVector3|number\tThe second item to add.\n-- @returns\tVector3\t\t\t\tThe result as a new Vector3 object.\nfunction Vector3.add(a, b)",
"params": [
{
"directive": "param",
"text": "a\tVector3|number\tThe first item to add.",
"name": "a",
"type": "Vector3|number",
"description": "The first item to add."
},
{
"directive": "param",
"text": "a\tVector3|number\tThe second item to add.",
"name": "a",
"type": "Vector3|number",
"description": "The second item to add."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\t\t\t\tThe result as a new Vector3 object.",
"type": "Vector3",
"description": "The result as a new Vector3 object."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.add",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L32-L39"
}
area 🔗
Returns the area of this vector. In other words, multiplies all the components together and returns a scalar value.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to return the area of. |
Returns
number
:
The area of this vector.
Source
--- Returns the area of this vector.
-- In other words, multiplies all the components together and returns a scalar value.
-- @param a Vector3 The vector to return the area of.
-- @returns number The area of this vector.
function Vector3.area(a)
{
"type": "function",
"internal": false,
"description": "Returns the area of this vector.\nIn other words, multiplies all the components together and returns a scalar value.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to return the area of.",
"name": "a",
"type": "Vector3",
"description": "The vector to return the area of."
},
{
"directive": "returns",
"text": "number\tThe area of this vector.",
"type": "number",
"description": "The area of this vector."
}
],
"line": 146,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 150,
"name": "area",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns the area of this vector.\n-- In other words, multiplies all the components together and returns a scalar value.\n-- @param\ta\t\tVector3\t\tThe vector to return the area of.\n-- @returns\tnumber\tThe area of this vector.\nfunction Vector3.area(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to return the area of.",
"name": "a",
"type": "Vector3",
"description": "The vector to return the area of."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe area of this vector.",
"type": "number",
"description": "The area of this vector."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.area",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L147-L151"
}
ceil 🔗
Rounds the components of this vector up.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
A new instance with the x/y/z components rounded up.
Source
--- Rounds the components of this vector up.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 A new instance with the x/y/z components rounded up.
function Vector3.ceil(a)
{
"type": "function",
"internal": false,
"description": "Rounds the components of this vector up.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tA new instance with the x/y/z components rounded up.",
"type": "Vector3",
"description": "A new instance with the x/y/z components rounded up."
}
],
"line": 114,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 117,
"name": "ceil",
"instanced": false,
"args": [
"a"
],
"text": "--- Rounds the components of this vector up.\n-- @param \ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tA new instance with the x/y/z components rounded up.\nfunction Vector3.ceil(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new instance with the x/y/z components rounded up.",
"type": "Vector3",
"description": "A new instance with the x/y/z components rounded up."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.ceil",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L115-L118"
}
clamp 🔗
Clamps the given point to fall within the region defined by 2 points.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The target vector to clamp. |
pos1 | Vector3 | nil | pos1 of the defined region. |
pos2 | Vector3 | nil | pos2 of the defined region. |
Returns
Vector3
:
The target vector, clamped to fall within the defined region.
Source
--- Clamps the given point to fall within the region defined by 2 points.
-- @param a Vector3 The target vector to clamp.
-- @param pos1 Vector3 pos1 of the defined region.
-- @param pos2 Vector3 pos2 of the defined region.
-- @returns Vector3 The target vector, clamped to fall within the defined region.
function Vector3.clamp(a, pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Clamps the given point to fall within the region defined by 2 points.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe target vector to clamp.",
"name": "a",
"type": "Vector3",
"description": "The target vector to clamp."
},
{
"directive": "param",
"text": "pos1\tVector3\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
},
{
"directive": "returns",
"text": "Vector3\tThe target vector, clamped to fall within the defined region.",
"type": "Vector3",
"description": "The target vector, clamped to fall within the defined region."
}
],
"line": 319,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 324,
"name": "clamp",
"instanced": false,
"args": [
"a",
"pos1",
"pos2"
],
"text": "--- Clamps the given point to fall within the region defined by 2 points.\n-- @param\ta\t\tVector3\t\tThe target vector to clamp.\n-- @param\tpos1\tVector3\tpos1 of the defined region.\n-- @param\tpos2\tVector3\tpos2 of the defined region.\n-- @returns\tVector3\tThe target vector, clamped to fall within the defined region.\nfunction Vector3.clamp(a, pos1, pos2)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe target vector to clamp.",
"name": "a",
"type": "Vector3",
"description": "The target vector to clamp."
},
{
"directive": "param",
"text": "pos1\tVector3\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tThe target vector, clamped to fall within the defined region.",
"type": "Vector3",
"description": "The target vector, clamped to fall within the defined region."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.clamp",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L320-L325"
}
clone 🔗
Returns a new instance of this vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to clone. |
Returns
Vector3
:
A new vector whose values are identical to those of the original vector.
Source
--- Returns a new instance of this vector.
-- @param a Vector3 The vector to clone.
-- @returns Vector3 A new vector whose values are identical to those of the original vector.
function Vector3.clone(a)
{
"type": "function",
"internal": false,
"description": "Returns a new instance of this vector.",
"directives": [
{
"directive": "param",
"text": "a\t\t\tVector3\t\tThe vector to clone.",
"name": "a",
"type": "Vector3",
"description": "The vector to clone."
},
{
"directive": "returns",
"text": "Vector3\t\tA new vector whose values are identical to those of the original vector.",
"type": "Vector3",
"description": "A new vector whose values are identical to those of the original vector."
}
],
"line": 24,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 27,
"name": "clone",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns a new instance of this vector.\n-- @param\ta\t\t\tVector3\t\tThe vector to clone.\n-- @returns\tVector3\t\tA new vector whose values are identical to those of the original vector.\nfunction Vector3.clone(a)",
"params": [
{
"directive": "param",
"text": "a\t\t\tVector3\t\tThe vector to clone.",
"name": "a",
"type": "Vector3",
"description": "The vector to clone."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\t\tA new vector whose values are identical to those of the original vector.",
"type": "Vector3",
"description": "A new vector whose values are identical to those of the original vector."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.clone",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L25-L28"
}
divide 🔗
Divides the specified vectors or numbers together. Returns the result as a new vector. If 1 of the inputs is a number and the other a vector, then the number will be divided to each of the components of the vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3|number | nil | The first item to divide. |
a | Vector3|number | nil | The second item to divide. |
Returns
Vector3
:
The result as a new Vector3 object.
Source
--- Divides the specified vectors or numbers together.
-- Returns the result as a new vector.
-- If 1 of the inputs is a number and the other a vector, then the number will
-- be divided to each of the components of the vector.
-- @param a Vector3|number The first item to divide.
-- @param a Vector3|number The second item to divide.
-- @returns Vector3 The result as a new Vector3 object.
function Vector3.divide(a, b)
{
"type": "function",
"internal": false,
"description": "Divides the specified vectors or numbers together.\nReturns the result as a new vector.\nIf 1 of the inputs is a number and the other a vector, then the number will\nbe divided to each of the components of the vector.",
"directives": [
{
"directive": "param",
"text": "a\tVector3|number\tThe first item to divide.",
"name": "a",
"type": "Vector3|number",
"description": "The first item to divide."
},
{
"directive": "param",
"text": "a\tVector3|number\tThe second item to divide.",
"name": "a",
"type": "Vector3|number",
"description": "The second item to divide."
},
{
"directive": "returns",
"text": "Vector3\t\t\t\tThe result as a new Vector3 object.",
"type": "Vector3",
"description": "The result as a new Vector3 object."
}
],
"line": 88,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 95,
"name": "divide",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Divides the specified vectors or numbers together.\n-- Returns the result as a new vector.\n-- If 1 of the inputs is a number and the other a vector, then the number will\n-- be divided to each of the components of the vector.\n-- @param\ta\tVector3|number\tThe first item to divide.\n-- @param\ta\tVector3|number\tThe second item to divide.\n-- @returns\tVector3\t\t\t\tThe result as a new Vector3 object.\nfunction Vector3.divide(a, b)",
"params": [
{
"directive": "param",
"text": "a\tVector3|number\tThe first item to divide.",
"name": "a",
"type": "Vector3|number",
"description": "The first item to divide."
},
{
"directive": "param",
"text": "a\tVector3|number\tThe second item to divide.",
"name": "a",
"type": "Vector3|number",
"description": "The second item to divide."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\t\t\t\tThe result as a new Vector3 object.",
"type": "Vector3",
"description": "The result as a new Vector3 object."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.divide",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L89-L96"
}
dot 🔗
Calculates the dot product of this vector and another vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The first vector to operate on. |
a | Vector3 | nil | The second vector to operate on. |
Returns
number
:
The dot product of this vector as a scalar value.
Source
--- Calculates the dot product of this vector and another vector.
-- @param a Vector3 The first vector to operate on.
-- @param a Vector3 The second vector to operate on.
-- @returns number The dot product of this vector as a scalar value.
function Vector3.dot(a, b)
{
"type": "function",
"internal": false,
"description": "Calculates the dot product of this vector and another vector.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe first vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "a\t\tVector3\t\tThe second vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The second vector to operate on."
},
{
"directive": "returns",
"text": "number\tThe dot product of this vector as a scalar value.",
"type": "number",
"description": "The dot product of this vector as a scalar value."
}
],
"line": 185,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 189,
"name": "dot",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Calculates the dot product of this vector and another vector.\n-- @param\ta\t\tVector3\t\tThe first vector to operate on.\n-- @param\ta\t\tVector3\t\tThe second vector to operate on.\n-- @returns\tnumber\tThe dot product of this vector as a scalar value.\nfunction Vector3.dot(a, b)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe first vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "a\t\tVector3\t\tThe second vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The second vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe dot product of this vector as a scalar value.",
"type": "number",
"description": "The dot product of this vector as a scalar value."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.dot",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L186-L190"
}
equals 🔗
Determines if 2 vectors are equal to each other. 2 vectors are equal if their values are identical.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The first vector to test. |
a | Vector3 | nil | The second vector to test. |
Returns
bool
:
Whether the 2 vectors are equal or not.
Source
--- Determines if 2 vectors are equal to each other.
-- 2 vectors are equal if their values are identical.
-- @param a Vector3 The first vector to test.
-- @param a Vector3 The second vector to test.
-- @returns bool Whether the 2 vectors are equal or not.
function Vector3.equals(a, b)
{
"type": "function",
"internal": false,
"description": "Determines if 2 vectors are equal to each other.\n2 vectors are equal if their values are identical.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe first vector to test.",
"name": "a",
"type": "Vector3",
"description": "The first vector to test."
},
{
"directive": "param",
"text": "a\t\tVector3\t\tThe second vector to test.",
"name": "a",
"type": "Vector3",
"description": "The second vector to test."
},
{
"directive": "returns",
"text": "bool\tWhether the 2 vectors are equal or not.",
"type": "bool",
"description": "Whether the 2 vectors are equal or not."
}
],
"line": 197,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 202,
"name": "equals",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Determines if 2 vectors are equal to each other.\n-- 2 vectors are equal if their values are identical.\n-- @param\ta\t\tVector3\t\tThe first vector to test.\n-- @param\ta\t\tVector3\t\tThe second vector to test.\n-- @returns\tbool\tWhether the 2 vectors are equal or not.\nfunction Vector3.equals(a, b)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe first vector to test.",
"name": "a",
"type": "Vector3",
"description": "The first vector to test."
},
{
"directive": "param",
"text": "a\t\tVector3\t\tThe second vector to test.",
"name": "a",
"type": "Vector3",
"description": "The second vector to test."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the 2 vectors are equal or not.",
"type": "bool",
"description": "Whether the 2 vectors are equal or not."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.equals",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L198-L203"
}
expand_region 🔗
Expands the defined region to include the given point.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
target | Vector3 | nil | The target vector to include. |
pos1 | Vector3 | nil | pos1 of the defined region. |
pos2 | Vector3 | nil | pos2 of the defined region. |
Returns
Vector3,Vector3
:
2 vectors that represent the expand_region.
Source
--- Expands the defined region to include the given point.
-- @param target Vector3 The target vector to include.
-- @param pos1 Vector3 pos1 of the defined region.
-- @param pos2 Vector3 pos2 of the defined region.
-- @returns Vector3,Vector3 2 vectors that represent the expand_region.
function Vector3.expand_region(target, pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Expands the defined region to include the given point.",
"directives": [
{
"directive": "param",
"text": "target\tVector3\tThe target vector to include.",
"name": "target",
"type": "Vector3",
"description": "The target vector to include."
},
{
"directive": "param",
"text": "pos1\tVector3\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
},
{
"directive": "returns",
"text": "Vector3,Vector3\t\t2 vectors that represent the expand_region.",
"type": "Vector3,Vector3",
"description": "2 vectors that represent the expand_region."
}
],
"line": 331,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 336,
"name": "expand_region",
"instanced": false,
"args": [
"target",
"pos1",
"pos2"
],
"text": "--- Expands the defined region to include the given point.\n-- @param\ttarget\tVector3\tThe target vector to include.\n-- @param\tpos1\tVector3\tpos1 of the defined region.\n-- @param\tpos2\tVector3\tpos2 of the defined region.\n-- @returns\tVector3,Vector3\t\t2 vectors that represent the expand_region.\nfunction Vector3.expand_region(target, pos1, pos2)",
"params": [
{
"directive": "param",
"text": "target\tVector3\tThe target vector to include.",
"name": "target",
"type": "Vector3",
"description": "The target vector to include."
},
{
"directive": "param",
"text": "pos1\tVector3\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
}
],
"returns": {
"directive": "returns",
"text": "Vector3,Vector3\t\t2 vectors that represent the expand_region.",
"type": "Vector3,Vector3",
"description": "2 vectors that represent the expand_region."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.expand_region",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L332-L337"
}
floor 🔗
Rounds the components of this vector down.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
A new instance with the x/y/z components rounded down.
Source
--- Rounds the components of this vector down.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 A new instance with the x/y/z components rounded down.
function Vector3.floor(a)
{
"type": "function",
"internal": false,
"description": "Rounds the components of this vector down.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tA new instance with the x/y/z components rounded down.",
"type": "Vector3",
"description": "A new instance with the x/y/z components rounded down."
}
],
"line": 108,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 111,
"name": "floor",
"instanced": false,
"args": [
"a"
],
"text": "--- Rounds the components of this vector down.\n-- @param \ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tA new instance with the x/y/z components rounded down.\nfunction Vector3.floor(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new instance with the x/y/z components rounded down.",
"type": "Vector3",
"description": "A new instance with the x/y/z components rounded down."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.floor",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L109-L112"
}
fromBearing 🔗
Given 2 angles and a length, return a Vector3 pointing in that direction. Consider a sphere, with the 2 angles defining a point on the sphere's surface. This function returns that point as a Vector3.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
angle_x | number | nil | The X angle. |
angle_y | number | nil | The Y angle. |
length | number | nil | The radius of the sphere in question. |
Returns
Vector3
:
The point on the sphere defined by the aforementioned parameters.
Source
--- Given 2 angles and a length, return a Vector3 pointing in that direction.
-- Consider a sphere, with the 2 angles defining a point on the sphere's surface.
-- This function returns that point as a Vector3.
-- @source https://math.stackexchange.com/a/1881767/221181
-- @param angle_x number The X angle.
-- @param angle_y number The Y angle.
-- @param length number The radius of the sphere in question.
-- @returns Vector3 The point on the sphere defined by the aforementioned parameters.
function Vector3.fromBearing(angle_x, angle_y, length)
{
"type": "function",
"internal": false,
"description": "Given 2 angles and a length, return a Vector3 pointing in that direction.\nConsider a sphere, with the 2 angles defining a point on the sphere's surface.\nThis function returns that point as a Vector3.",
"directives": [
{
"directive": "source",
"text": "https://math.stackexchange.com/a/1881767/221181"
},
{
"directive": "param",
"text": "angle_x\t\tnumber\tThe X angle.",
"name": "angle_x",
"type": "number",
"description": "The X angle."
},
{
"directive": "param",
"text": "angle_y\t\tnumber\tThe Y angle.",
"name": "angle_y",
"type": "number",
"description": "The Y angle."
},
{
"directive": "param",
"text": "length\t\tnumber\tThe radius of the sphere in question.",
"name": "length",
"type": "number",
"description": "The radius of the sphere in question."
},
{
"directive": "returns",
"text": "Vector3\t\tThe point on the sphere defined by the aforementioned parameters.",
"type": "Vector3",
"description": "The point on the sphere defined by the aforementioned parameters."
}
],
"line": 396,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 404,
"name": "fromBearing",
"instanced": false,
"args": [
"angle_x",
"angle_y",
"length"
],
"text": "--- Given 2 angles and a length, return a Vector3 pointing in that direction.\n-- Consider a sphere, with the 2 angles defining a point on the sphere's surface.\n-- This function returns that point as a Vector3.\n-- @source\thttps://math.stackexchange.com/a/1881767/221181\n-- @param\tangle_x\t\tnumber\tThe X angle.\n-- @param\tangle_y\t\tnumber\tThe Y angle.\n-- @param\tlength\t\tnumber\tThe radius of the sphere in question.\n-- @returns\tVector3\t\tThe point on the sphere defined by the aforementioned parameters.\nfunction Vector3.fromBearing(angle_x, angle_y, length)",
"params": [
{
"directive": "param",
"text": "angle_x\t\tnumber\tThe X angle.",
"name": "angle_x",
"type": "number",
"description": "The X angle."
},
{
"directive": "param",
"text": "angle_y\t\tnumber\tThe Y angle.",
"name": "angle_y",
"type": "number",
"description": "The Y angle."
},
{
"directive": "param",
"text": "length\t\tnumber\tThe radius of the sphere in question.",
"name": "length",
"type": "number",
"description": "The radius of the sphere in question."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\t\tThe point on the sphere defined by the aforementioned parameters.",
"type": "Vector3",
"description": "The point on the sphere defined by the aforementioned parameters."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.fromBearing",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L397-L405"
}
is_contained 🔗
Determines if this vector is contained within the region defined by the given vectors.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The target vector to check. |
pos1 | Vector3 | nil | pos1 of the defined region. |
pos2 | Vector3 | nil | pos2 of the defined region. |
Returns
boolean
:
Whether the given target is contained within the defined worldedit region.
Source
--- Determines if this vector is contained within the region defined by the given vectors.
-- @param a Vector3 The target vector to check.
-- @param pos1 Vector3 pos1 of the defined region.
-- @param pos2 Vector3 pos2 of the defined region.
-- @return boolean Whether the given target is contained within the defined worldedit region.
function Vector3.is_contained(target, pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Determines if this vector is contained within the region defined by the given vectors.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe target vector to check.",
"name": "a",
"type": "Vector3",
"description": "The target vector to check."
},
{
"directive": "param",
"text": "pos1\tVector3\t\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
},
{
"directive": "returns",
"text": "boolean\tWhether the given target is contained within the defined worldedit region.",
"type": "boolean",
"description": "Whether the given target is contained within the defined worldedit region."
}
],
"line": 303,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 308,
"name": "is_contained",
"instanced": false,
"args": [
"target",
"pos1",
"pos2"
],
"text": "--- Determines if this vector is contained within the region defined by the given vectors.\n-- @param\ta\t\tVector3\t\tThe target vector to check.\n-- @param\tpos1\tVector3\t\tpos1 of the defined region.\n-- @param\tpos2\tVector3\t\tpos2 of the defined region.\n-- @return\tboolean\tWhether the given target is contained within the defined worldedit region.\nfunction Vector3.is_contained(target, pos1, pos2)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe target vector to check.",
"name": "a",
"type": "Vector3",
"description": "The target vector to check."
},
{
"directive": "param",
"text": "pos1\tVector3\t\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3",
"description": "pos2 of the defined region."
}
],
"returns": {
"directive": "returns",
"text": "boolean\tWhether the given target is contained within the defined worldedit region.",
"type": "boolean",
"description": "Whether the given target is contained within the defined worldedit region."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.is_contained",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L304-L309"
}
length 🔗
Calculates the scalar length of this vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
number
:
The length of this vector as a scalar value.
Source
--- Calculates the scalar length of this vector.
-- @param a Vector3 The vector to operate on.
-- @returns number The length of this vector as a scalar value.
function Vector3.length(a)
{
"type": "function",
"internal": false,
"description": "Calculates the scalar length of this vector.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "number\tThe length of this vector as a scalar value.",
"type": "number",
"description": "The length of this vector as a scalar value."
}
],
"line": 168,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 171,
"name": "length",
"instanced": false,
"args": [
"a"
],
"text": "--- Calculates the scalar length of this vector.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tnumber\tThe length of this vector as a scalar value.\nfunction Vector3.length(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe length of this vector as a scalar value.",
"type": "number",
"description": "The length of this vector as a scalar value."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.length",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L169-L172"
}
length_squared 🔗
Returns the scalar length of this vector squared.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
number
:
The length squared of this vector as a scalar value.
Source
--- Returns the scalar length of this vector squared.
-- @param a Vector3 The vector to operate on.
-- @returns number The length squared of this vector as a scalar value.
function Vector3.length_squared(a)
{
"type": "function",
"internal": false,
"description": "Returns the scalar length of this vector squared.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "number\tThe length squared of this vector as a scalar value.",
"type": "number",
"description": "The length squared of this vector as a scalar value."
}
],
"line": 154,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 157,
"name": "length_squared",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns the scalar length of this vector squared.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tnumber\tThe length squared of this vector as a scalar value.\nfunction Vector3.length_squared(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe length squared of this vector as a scalar value.",
"type": "number",
"description": "The length squared of this vector as a scalar value."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.length_squared",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L155-L158"
}
limit_to 🔗
Returns a new vector whose length clamped to the given length. The direction in which the vector is pointing is not changed.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
A new Vector3 instance limited to the specified length.
Source
--- Returns a new vector whose length clamped to the given length.
-- The direction in which the vector is pointing is not changed.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 A new Vector3 instance limited to the specified length.
function Vector3.limit_to(a, length)
{
"type": "function",
"internal": false,
"description": "Returns a new vector whose length clamped to the given length.\nThe direction in which the vector is pointing is not changed.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tA new Vector3 instance limited to the specified length.",
"type": "Vector3",
"description": "A new Vector3 instance limited to the specified length."
}
],
"line": 208,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 212,
"name": "limit_to",
"instanced": false,
"args": [
"a",
"length"
],
"text": "--- Returns a new vector whose length clamped to the given length.\n-- The direction in which the vector is pointing is not changed.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tA new Vector3 instance limited to the specified length.\nfunction Vector3.limit_to(a, length)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new Vector3 instance limited to the specified length.",
"type": "Vector3",
"description": "A new Vector3 instance limited to the specified length."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.limit_to",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L209-L213"
}
max 🔗
Returns a vector of the max values of 2 vectors.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The first vector to operate on. |
pos2 | Vector3 | nil | The second vector to operate on. |
Returns
Vector3
:
The maximum values from the input vectors.
Source
--- Returns a vector of the max values of 2 vectors.
-- @param pos1 Vector3 The first vector to operate on.
-- @param pos2 Vector3 The second vector to operate on.
-- @return Vector3 The maximum values from the input vectors.
function Vector3.max(pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Returns a vector of the max values of 2 vectors.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe first vector to operate on.",
"name": "pos1",
"type": "Vector3",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe second vector to operate on.",
"name": "pos2",
"type": "Vector3",
"description": "The second vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\t\tThe maximum values from the input vectors.",
"type": "Vector3",
"description": "The maximum values from the input vectors."
}
],
"line": 378,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 382,
"name": "max",
"instanced": false,
"args": [
"pos1",
"pos2"
],
"text": "--- Returns a vector of the max values of 2 vectors.\n-- @param\tpos1\tVector3\t\tThe first vector to operate on.\n-- @param\tpos2\tVector3\t\tThe second vector to operate on.\n-- @return\tVector3\t\tThe maximum values from the input vectors.\nfunction Vector3.max(pos1, pos2)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe first vector to operate on.",
"name": "pos1",
"type": "Vector3",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe second vector to operate on.",
"name": "pos2",
"type": "Vector3",
"description": "The second vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\t\tThe maximum values from the input vectors.",
"type": "Vector3",
"description": "The maximum values from the input vectors."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.max",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L379-L383"
}
max_component 🔗
Returns the value of the maximum component of the vector. Returns a scalar value.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
number
:
The value of the maximum component of the vector.
Source
--- Returns the value of the maximum component of the vector.
-- Returns a scalar value.
-- @param a Vector3 The vector to operate on.
-- @returns number The value of the maximum component of the vector.
function Vector3.max_component(a)
{
"type": "function",
"internal": false,
"description": "Returns the value of the maximum component of the vector.\nReturns a scalar value.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "number\tThe value of the maximum component of the vector.",
"type": "number",
"description": "The value of the maximum component of the vector."
}
],
"line": 260,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 264,
"name": "max_component",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns the value of the maximum component of the vector.\n-- Returns a scalar value.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tnumber\tThe value of the maximum component of the vector.\nfunction Vector3.max_component(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe value of the maximum component of the vector.",
"type": "number",
"description": "The value of the maximum component of the vector."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.max_component",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L261-L265"
}
mean 🔗
Returns the mean (average) of 2 positions. In other words, returns the centre of 2 points.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3|number | nil | pos1 of the defined region. |
pos2 | Vector3|number | nil | pos2 of the defined region. |
target | Vector3 | nil | Centre coordinates. |
Returns
nil
Source
--- Returns the mean (average) of 2 positions.
-- In other words, returns the centre of 2 points.
-- @param pos1 Vector3|number pos1 of the defined region.
-- @param pos2 Vector3|number pos2 of the defined region.
-- @param target Vector3 Centre coordinates.
function Vector3.mean(pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Returns the mean (average) of 2 positions.\nIn other words, returns the centre of 2 points.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3|number\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3|number",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3|number\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3|number",
"description": "pos2 of the defined region."
},
{
"directive": "param",
"text": "target\tVector3\tCentre coordinates.",
"name": "target",
"type": "Vector3",
"description": "Centre coordinates."
}
],
"line": 350,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 355,
"name": "mean",
"instanced": false,
"args": [
"pos1",
"pos2"
],
"text": "--- Returns the mean (average) of 2 positions.\n-- In other words, returns the centre of 2 points.\n-- @param\tpos1\tVector3|number\tpos1 of the defined region.\n-- @param\tpos2\tVector3|number\tpos2 of the defined region.\n-- @param\ttarget\tVector3\tCentre coordinates.\nfunction Vector3.mean(pos1, pos2)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3|number\tpos1 of the defined region.",
"name": "pos1",
"type": "Vector3|number",
"description": "pos1 of the defined region."
},
{
"directive": "param",
"text": "pos2\tVector3|number\tpos2 of the defined region.",
"name": "pos2",
"type": "Vector3|number",
"description": "pos2 of the defined region."
},
{
"directive": "param",
"text": "target\tVector3\tCentre coordinates.",
"name": "target",
"type": "Vector3",
"description": "Centre coordinates."
}
],
"examples": [],
"name_full": "worldeditadditions_core.Vector3.mean",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L351-L356"
}
min 🔗
Returns a vector of the min components of 2 vectors.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3|number | nil | The first vector to operate on. |
pos2 | Vector3|number | nil | The second vector to operate on. |
Returns
Vector3
:
The minimum values from the input vectors
Source
--- Returns a vector of the min components of 2 vectors.
-- @param pos1 Vector3|number The first vector to operate on.
-- @param pos2 Vector3|number The second vector to operate on.
-- @return Vector3 The minimum values from the input vectors
function Vector3.min(pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Returns a vector of the min components of 2 vectors.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3|number\tThe first vector to operate on.",
"name": "pos1",
"type": "Vector3|number",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3|number\tThe second vector to operate on.",
"name": "pos2",
"type": "Vector3|number",
"description": "The second vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tThe minimum values from the input vectors",
"type": "Vector3",
"description": "The minimum values from the input vectors"
}
],
"line": 360,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 364,
"name": "min",
"instanced": false,
"args": [
"pos1",
"pos2"
],
"text": "--- Returns a vector of the min components of 2 vectors.\n-- @param\tpos1\tVector3|number\tThe first vector to operate on.\n-- @param\tpos2\tVector3|number\tThe second vector to operate on.\n-- @return\tVector3\tThe minimum values from the input vectors\nfunction Vector3.min(pos1, pos2)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3|number\tThe first vector to operate on.",
"name": "pos1",
"type": "Vector3|number",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3|number\tThe second vector to operate on.",
"name": "pos2",
"type": "Vector3|number",
"description": "The second vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tThe minimum values from the input vectors",
"type": "Vector3",
"description": "The minimum values from the input vectors"
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.min",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L361-L365"
}
min_component 🔗
Returns the value of the minimum component of the vector. Returns a scalar value.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
number
:
The value of the minimum component of the vector.
Source
--- Returns the value of the minimum component of the vector.
-- Returns a scalar value.
-- @param a Vector3 The vector to operate on.
-- @returns number The value of the minimum component of the vector.
function Vector3.min_component(a)
{
"type": "function",
"internal": false,
"description": "Returns the value of the minimum component of the vector.\nReturns a scalar value.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "number\tThe value of the minimum component of the vector.",
"type": "number",
"description": "The value of the minimum component of the vector."
}
],
"line": 252,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 256,
"name": "min_component",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns the value of the minimum component of the vector.\n-- Returns a scalar value.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tnumber\tThe value of the minimum component of the vector.\nfunction Vector3.min_component(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe value of the minimum component of the vector.",
"type": "number",
"description": "The value of the minimum component of the vector."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.min_component",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L253-L257"
}
move_towards 🔗
Return a vector that is amount distance towards b from a.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to move from. |
b | Vector3 | nil | The vector to move towards. |
amount | number | nil | The amount to move. |
Returns
nil
Source
--- Return a vector that is amount distance towards b from a.
-- @param a Vector3 The vector to move from.
-- @param b Vector3 The vector to move towards.
-- @param amount number The amount to move.
function Vector3.move_towards(a, b, amount)
{
"type": "function",
"internal": false,
"description": "Return a vector that is amount distance towards b from a.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to move from.",
"name": "a",
"type": "Vector3",
"description": "The vector to move from."
},
{
"directive": "param",
"text": "b\t\tVector3\t\tThe vector to move towards.",
"name": "b",
"type": "Vector3",
"description": "The vector to move towards."
},
{
"directive": "param",
"text": "amount\tnumber\t\tThe amount to move.",
"name": "amount",
"type": "number",
"description": "The amount to move."
}
],
"line": 244,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 248,
"name": "move_towards",
"instanced": false,
"args": [
"a",
"b",
"amount"
],
"text": "--- Return a vector that is amount distance towards b from a.\n-- @param\ta\t\tVector3\t\tThe vector to move from.\n-- @param\tb\t\tVector3\t\tThe vector to move towards.\n-- @param\tamount\tnumber\t\tThe amount to move.\nfunction Vector3.move_towards(a, b, amount)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to move from.",
"name": "a",
"type": "Vector3",
"description": "The vector to move from."
},
{
"directive": "param",
"text": "b\t\tVector3\t\tThe vector to move towards.",
"name": "b",
"type": "Vector3",
"description": "The vector to move towards."
},
{
"directive": "param",
"text": "amount\tnumber\t\tThe amount to move.",
"name": "amount",
"type": "number",
"description": "The amount to move."
}
],
"examples": [],
"name_full": "worldeditadditions_core.Vector3.move_towards",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L245-L249"
}
new 🔗
Creates a new Vector3 instance.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
x | number | nil | The x co-ordinate value. |
y | number | nil | The y co-ordinate value. |
z | number | nil | The z co-ordinate value. |
Returns
nil
Source
--- 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)
{
"type": "function",
"internal": false,
"description": "Creates a new Vector3 instance.",
"directives": [
{
"directive": "param",
"text": "x\t\tnumber\tThe x co-ordinate value.",
"name": "x",
"type": "number",
"description": "The x co-ordinate value."
},
{
"directive": "param",
"text": "y\t\tnumber\tThe y co-ordinate value.",
"name": "y",
"type": "number",
"description": "The y co-ordinate value."
},
{
"directive": "param",
"text": "z\t\tnumber\tThe z co-ordinate value.",
"name": "z",
"type": "number",
"description": "The z co-ordinate value."
}
],
"line": 6,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 10,
"name": "new",
"instanced": false,
"args": [
"x",
"y",
"z"
],
"text": "--- Creates a new Vector3 instance.\n-- @param x\t\tnumber\tThe x co-ordinate value.\n-- @param y\t\tnumber\tThe y co-ordinate value.\n-- @param z\t\tnumber\tThe z co-ordinate value.\nfunction Vector3.new(x, y, z)",
"params": [
{
"directive": "param",
"text": "x\t\tnumber\tThe x co-ordinate value.",
"name": "x",
"type": "number",
"description": "The x co-ordinate value."
},
{
"directive": "param",
"text": "y\t\tnumber\tThe y co-ordinate value.",
"name": "y",
"type": "number",
"description": "The y co-ordinate value."
},
{
"directive": "param",
"text": "z\t\tnumber\tThe z co-ordinate value.",
"name": "z",
"type": "number",
"description": "The z co-ordinate value."
}
],
"examples": [],
"name_full": "worldeditadditions_core.Vector3.new",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L7-L11"
}
rotate3d 🔗
Rotate a given point around an origin point in 3d space. Consider 3 axes (X, Y, and Z) that are centred on origin. This function rotates point around these axes in the aforementioned order.
NOTE: This function is not as intuitive as it sounds. A whiteboard and a head for mathematics is recommended before using this function. Either that, or Blender 3 (https://blender.org/) is quite useful to visualise what's going on.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
origin | Vector3 | nil | The origin point to rotate around |
point | Vector3 | nil | The point to rotate. |
rotate | Vector3 | nil | Rotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians! |
Returns
Vector3
:
The rotated point.
Source
--- Rotate a given point around an origin point in 3d space.
-- Consider 3 axes (X, Y, and Z) that are centred on origin. This function
-- rotates point around these axes in the aforementioned order.
--
-- NOTE: This function is not as intuitive as it sounds.
-- A whiteboard and a head for mathematics is recommended before using this
-- function. Either that, or Blender 3 (https://blender.org/) is quite useful to visualise what's going on.
-- @source GitHub Copilot, generated 2023-01-17
-- @warning Not completely tested! Pending a thorough evaluation. Seems to basically work, after some tweaks to the fluff around the edges?
-- @param origin Vector3 The origin point to rotate around
-- @param point Vector3 The point to rotate.
-- @param rotate Vector3 Rotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians!
-- @return Vector3 The rotated point.
function Vector3.rotate3d(origin, point, rotate)
{
"type": "function",
"internal": false,
"description": "Rotate a given point around an origin point in 3d space.\nConsider 3 axes (X, Y, and Z) that are centred on origin. This function\nrotates point around these axes in the aforementioned order.\n\nNOTE: This function is not as intuitive as it sounds.\nA whiteboard and a head for mathematics is recommended before using this\nfunction. Either that, or Blender 3 (https://blender.org/) is quite useful to visualise what's going on.",
"directives": [
{
"directive": "source",
"text": "GitHub Copilot, generated 2023-01-17"
},
{
"directive": "warning",
"text": "Not completely tested! Pending a thorough evaluation. Seems to basically work, after some tweaks to the fluff around the edges?"
},
{
"directive": "param",
"text": "origin\tVector3\tThe origin point to rotate around",
"name": "origin",
"type": "Vector3",
"description": "The origin point to rotate around"
},
{
"directive": "param",
"text": "point\tVector3\tThe point to rotate.",
"name": "point",
"type": "Vector3",
"description": "The point to rotate."
},
{
"directive": "param",
"text": "rotate\tVector3\tRotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians!",
"name": "rotate",
"type": "Vector3",
"description": "Rotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians!"
},
{
"directive": "returns",
"text": "Vector3\tThe rotated point.",
"type": "Vector3",
"description": "The rotated point."
}
],
"line": 412,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 425,
"name": "rotate3d",
"instanced": false,
"args": [
"origin",
"point",
"rotate"
],
"text": "--- Rotate a given point around an origin point in 3d space.\n-- Consider 3 axes (X, Y, and Z) that are centred on origin. This function\n-- rotates point around these axes in the aforementioned order.\n-- \n-- NOTE: This function is not as intuitive as it sounds.\n-- A whiteboard and a head for mathematics is recommended before using this\n-- function. Either that, or Blender 3 (https://blender.org/) is quite useful to visualise what's going on.\n-- @source\tGitHub Copilot, generated 2023-01-17\n-- @warning\tNot completely tested! Pending a thorough evaluation. Seems to basically work, after some tweaks to the fluff around the edges?\n-- @param\torigin\tVector3\tThe origin point to rotate around\n-- @param\tpoint\tVector3\tThe point to rotate.\n-- @param\trotate\tVector3\tRotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians!\n-- @return\tVector3\tThe rotated point.\nfunction Vector3.rotate3d(origin, point, rotate)",
"params": [
{
"directive": "param",
"text": "origin\tVector3\tThe origin point to rotate around",
"name": "origin",
"type": "Vector3",
"description": "The origin point to rotate around"
},
{
"directive": "param",
"text": "point\tVector3\tThe point to rotate.",
"name": "point",
"type": "Vector3",
"description": "The point to rotate."
},
{
"directive": "param",
"text": "rotate\tVector3\tRotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians!",
"name": "rotate",
"type": "Vector3",
"description": "Rotate this much around the 3 different axes, x, y, and z. Axial rotations are handled in this order: X→Y→Z. Values MUST be in radians!"
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tThe rotated point.",
"type": "Vector3",
"description": "The rotated point."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.rotate3d",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L413-L426"
}
round 🔗
Rounds the components of this vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
A new instance with the x/y/z components rounded.
Source
--- Rounds the components of this vector.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 A new instance with the x/y/z components rounded.
function Vector3.round(a)
{
"type": "function",
"internal": false,
"description": "Rounds the components of this vector.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tA new instance with the x/y/z components rounded.",
"type": "Vector3",
"description": "A new instance with the x/y/z components rounded."
}
],
"line": 120,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 123,
"name": "round",
"instanced": false,
"args": [
"a"
],
"text": "--- Rounds the components of this vector.\n-- @param \ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tA new instance with the x/y/z components rounded.\nfunction Vector3.round(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new instance with the x/y/z components rounded.",
"type": "Vector3",
"description": "A new instance with the x/y/z components rounded."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.round",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L121-L124"
}
round_dp 🔗
Rounds the components of this vector to the specified number of decimal places.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to round. |
dp | number | nil | The number of decimal places to round to. |
Returns
Vector3
:
A new instance with the components rounded to the specified number of decimal places.
Source
--- Rounds the components of this vector to the specified number of decimal places.
-- @param a Vector3 The vector to round.
-- @param dp number The number of decimal places to round to.
-- @returns Vector3 A new instance with the components rounded to the specified number of decimal places.
function Vector3.round_dp(a, dp)
{
"type": "function",
"internal": false,
"description": "Rounds the components of this vector to the specified number of decimal places.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\tThe vector to round.",
"name": "a",
"type": "Vector3",
"description": "The vector to round."
},
{
"directive": "param",
"text": "dp\t\tnumber\tThe number of decimal places to round to.",
"name": "dp",
"type": "number",
"description": "The number of decimal places to round to."
},
{
"directive": "returns",
"text": "Vector3\tA new instance with the components rounded to the specified number of decimal places.",
"type": "Vector3",
"description": "A new instance with the components rounded to the specified number of decimal places."
}
],
"line": 127,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 131,
"name": "round_dp",
"instanced": false,
"args": [
"a",
"dp"
],
"text": "--- Rounds the components of this vector to the specified number of decimal places.\n-- @param\ta\t\tVector3\tThe vector to round.\n-- @param\tdp\t\tnumber\tThe number of decimal places to round to.\n-- @returns\tVector3\tA new instance with the components rounded to the specified number of decimal places.\nfunction Vector3.round_dp(a, dp)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\tThe vector to round.",
"name": "a",
"type": "Vector3",
"description": "The vector to round."
},
{
"directive": "param",
"text": "dp\t\tnumber\tThe number of decimal places to round to.",
"name": "dp",
"type": "number",
"description": "The number of decimal places to round to."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new instance with the components rounded to the specified number of decimal places.",
"type": "Vector3",
"description": "A new instance with the components rounded to the specified number of decimal places."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.round_dp",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L128-L132"
}
set_to 🔗
Returns a new vector whose length clamped to the given length. The direction in which the vector is pointing is not changed.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
A new Vector3 instance limited to the specified length.
Source
--- Returns a new vector whose length clamped to the given length.
-- The direction in which the vector is pointing is not changed.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 A new Vector3 instance limited to the specified length.
function Vector3.set_to(a, length)
{
"type": "function",
"internal": false,
"description": "Returns a new vector whose length clamped to the given length.\nThe direction in which the vector is pointing is not changed.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tA new Vector3 instance limited to the specified length.",
"type": "Vector3",
"description": "A new Vector3 instance limited to the specified length."
}
],
"line": 221,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 225,
"name": "set_to",
"instanced": false,
"args": [
"a",
"length"
],
"text": "--- Returns a new vector whose length clamped to the given length.\n-- The direction in which the vector is pointing is not changed.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tA new Vector3 instance limited to the specified length.\nfunction Vector3.set_to(a, length)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new Vector3 instance limited to the specified length.",
"type": "Vector3",
"description": "A new Vector3 instance limited to the specified length."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.set_to",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L222-L226"
}
snap_to 🔗
Snaps this Vector3 to an imaginary square grid with the specified sized squares.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
number | grid_size | nil | The size of the squares on the imaginary grid to which to snap. |
Returns
Vector3
:
A new Vector3 instance snapped to an imaginary grid of the specified size.
Source
--- Snaps this Vector3 to an imaginary square grid with the specified sized
-- squares.
-- @param a Vector3 The vector to operate on.
-- @param number grid_size The size of the squares on the imaginary grid to which to snap.
-- @returns Vector3 A new Vector3 instance snapped to an imaginary grid of the specified size.
function Vector3.snap_to(a, grid_size)
{
"type": "function",
"internal": false,
"description": "Snaps this Vector3 to an imaginary square grid with the specified sized\nsquares.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "param",
"text": "number\tgrid_size\tThe size of the squares on the imaginary grid to which to snap.",
"name": "number",
"type": "grid_size",
"description": "The size of the squares on the imaginary grid to which to snap."
},
{
"directive": "returns",
"text": "Vector3\tA new Vector3 instance snapped to an imaginary grid of the specified size.",
"type": "Vector3",
"description": "A new Vector3 instance snapped to an imaginary grid of the specified size."
}
],
"line": 137,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 142,
"name": "snap_to",
"instanced": false,
"args": [
"a",
"grid_size"
],
"text": "--- Snaps this Vector3 to an imaginary square grid with the specified sized\n-- squares.\n-- @param \ta\t\tVector3\t\tThe vector to operate on.\n-- @param\tnumber\tgrid_size\tThe size of the squares on the imaginary grid to which to snap.\n-- @returns\tVector3\tA new Vector3 instance snapped to an imaginary grid of the specified size.\nfunction Vector3.snap_to(a, grid_size)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "param",
"text": "number\tgrid_size\tThe size of the squares on the imaginary grid to which to snap.",
"name": "number",
"type": "grid_size",
"description": "The size of the squares on the imaginary grid to which to snap."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tA new Vector3 instance snapped to an imaginary grid of the specified size.",
"type": "Vector3",
"description": "A new Vector3 instance snapped to an imaginary grid of the specified size."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.snap_to",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L138-L143"
}
sort 🔗
Sorts the components of the given vectors. pos1 will contain the minimum values, and pos2 the maximum values. Returns 2 new vectors. Note that for this specific function the vectors provided do not have to be instances of Vector3. It is only required that they have the keys x, y, and z. Vector3 instances are always returned. This enables convenient ingesting of positions from outside.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
pos1 | Vector3 | nil | The first vector to operate on. |
pos2 | Vector3 | nil | The second vector to operate on. |
Returns
Vector3,Vector3
:
The 2 sorted vectors (min, max).
Source
--- Sorts the components of the given vectors.
-- pos1 will contain the minimum values, and pos2 the maximum values.
-- Returns 2 new vectors.
-- Note that for this specific function
-- the vectors provided do not *have* to be instances of Vector3.
-- It is only required that they have the keys x, y, and z.
-- Vector3 instances are always returned.
-- This enables convenient ingesting of positions from outside.
-- @param pos1 Vector3 The first vector to operate on.
-- @param pos2 Vector3 The second vector to operate on.
-- @returns Vector3,Vector3 The 2 sorted vectors (min, max).
function Vector3.sort(pos1, pos2)
{
"type": "function",
"internal": false,
"description": "Sorts the components of the given vectors.\npos1 will contain the minimum values, and pos2 the maximum values.\nReturns 2 new vectors.\nNote that for this specific function\nthe vectors provided do not *have* to be instances of Vector3.\nIt is only required that they have the keys x, y, and z.\nVector3 instances are always returned.\nThis enables convenient ingesting of positions from outside.",
"directives": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe first vector to operate on.",
"name": "pos1",
"type": "Vector3",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe second vector to operate on.",
"name": "pos2",
"type": "Vector3",
"description": "The second vector to operate on."
},
{
"directive": "returns",
"text": "Vector3,Vector3\t\tThe 2 sorted vectors (min, max).",
"type": "Vector3,Vector3",
"description": "The 2 sorted vectors (min, max)."
}
],
"line": 276,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 287,
"name": "sort",
"instanced": false,
"args": [
"pos1",
"pos2"
],
"text": "--- Sorts the components of the given vectors.\n-- pos1 will contain the minimum values, and pos2 the maximum values.\n-- Returns 2 new vectors.\n-- Note that for this specific function\n-- the vectors provided do not *have* to be instances of Vector3.\n-- It is only required that they have the keys x, y, and z.\n-- Vector3 instances are always returned.\n-- This enables convenient ingesting of positions from outside.\n-- @param\tpos1\tVector3\t\tThe first vector to operate on.\n-- @param\tpos2\tVector3\t\tThe second vector to operate on.\n-- @returns\tVector3,Vector3\t\tThe 2 sorted vectors (min, max).\nfunction Vector3.sort(pos1, pos2)",
"params": [
{
"directive": "param",
"text": "pos1\tVector3\t\tThe first vector to operate on.",
"name": "pos1",
"type": "Vector3",
"description": "The first vector to operate on."
},
{
"directive": "param",
"text": "pos2\tVector3\t\tThe second vector to operate on.",
"name": "pos2",
"type": "Vector3",
"description": "The second vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3,Vector3\t\tThe 2 sorted vectors (min, max).",
"type": "Vector3,Vector3",
"description": "The 2 sorted vectors (min, max)."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.sort",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L277-L288"
}
sqrt 🔗
Square roots each component of this vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
number
:
A new vector with each component square rooted.
Source
--- Square roots each component of this vector.
-- @param a Vector3 The vector to operate on.
-- @returns number A new vector with each component square rooted.
function Vector3.sqrt(a)
{
"type": "function",
"internal": false,
"description": "Square roots each component of this vector.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "number\tA new vector with each component square rooted.",
"type": "number",
"description": "A new vector with each component square rooted."
}
],
"line": 161,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 164,
"name": "sqrt",
"instanced": false,
"args": [
"a"
],
"text": "--- Square roots each component of this vector.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tnumber\tA new vector with each component square rooted.\nfunction Vector3.sqrt(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "number\tA new vector with each component square rooted.",
"type": "number",
"description": "A new vector with each component square rooted."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.sqrt",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L162-L165"
}
subtract 🔗
Subtracts the specified vectors or numbers together. Returns the result as a new vector. If 1 of the inputs is a number and the other a vector, then the number will be subtracted to each of the components of the vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3|number | nil | The first item to subtract. |
a | Vector3|number | nil | The second item to subtract. |
Returns
Vector3
:
The result as a new Vector3 object.
Source
--- Subtracts the specified vectors or numbers together.
-- Returns the result as a new vector.
-- If 1 of the inputs is a number and the other a vector, then the number will
-- be subtracted to each of the components of the vector.
-- @param a Vector3|number The first item to subtract.
-- @param a Vector3|number The second item to subtract.
-- @returns Vector3 The result as a new Vector3 object.
function Vector3.subtract(a, b)
{
"type": "function",
"internal": false,
"description": "Subtracts the specified vectors or numbers together.\nReturns the result as a new vector.\nIf 1 of the inputs is a number and the other a vector, then the number will\nbe subtracted to each of the components of the vector.",
"directives": [
{
"directive": "param",
"text": "a\tVector3|number\tThe first item to subtract.",
"name": "a",
"type": "Vector3|number",
"description": "The first item to subtract."
},
{
"directive": "param",
"text": "a\tVector3|number\tThe second item to subtract.",
"name": "a",
"type": "Vector3|number",
"description": "The second item to subtract."
},
{
"directive": "returns",
"text": "Vector3\t\t\t\tThe result as a new Vector3 object.",
"type": "Vector3",
"description": "The result as a new Vector3 object."
}
],
"line": 47,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 54,
"name": "subtract",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Subtracts the specified vectors or numbers together.\n-- Returns the result as a new vector.\n-- If 1 of the inputs is a number and the other a vector, then the number will\n-- be subtracted to each of the components of the vector.\n-- @param\ta\tVector3|number\tThe first item to subtract.\n-- @param\ta\tVector3|number\tThe second item to subtract.\n-- @returns\tVector3\t\t\t\tThe result as a new Vector3 object.\nfunction Vector3.subtract(a, b)",
"params": [
{
"directive": "param",
"text": "a\tVector3|number\tThe first item to subtract.",
"name": "a",
"type": "Vector3|number",
"description": "The first item to subtract."
},
{
"directive": "param",
"text": "a\tVector3|number\tThe second item to subtract.",
"name": "a",
"type": "Vector3|number",
"description": "The second item to subtract."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\t\t\t\tThe result as a new Vector3 object.",
"type": "Vector3",
"description": "The result as a new Vector3 object."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.subtract",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L48-L55"
}
unit 🔗
Returns the unit vector of this vector. The unit vector is a vector with a length of 1. Returns a new vector. Does not change the direction of the vector.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The vector to operate on. |
Returns
Vector3
:
The unit vector of this vector.
Source
--- Returns the unit vector of this vector.
-- The unit vector is a vector with a length of 1.
-- Returns a new vector.
-- Does not change the direction of the vector.
-- @param a Vector3 The vector to operate on.
-- @returns Vector3 The unit vector of this vector.
function Vector3.unit(a)
{
"type": "function",
"internal": false,
"description": "Returns the unit vector of this vector.\nThe unit vector is a vector with a length of 1.\nReturns a new vector.\nDoes not change the direction of the vector.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
},
{
"directive": "returns",
"text": "Vector3\tThe unit vector of this vector.",
"type": "Vector3",
"description": "The unit vector of this vector."
}
],
"line": 231,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 237,
"name": "unit",
"instanced": false,
"args": [
"a"
],
"text": "--- Returns the unit vector of this vector.\n-- The unit vector is a vector with a length of 1.\n-- Returns a new vector.\n-- Does not change the direction of the vector.\n-- @param\ta\t\tVector3\t\tThe vector to operate on.\n-- @returns\tVector3\tThe unit vector of this vector.\nfunction Vector3.unit(a)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe vector to operate on.",
"name": "a",
"type": "Vector3",
"description": "The vector to operate on."
}
],
"returns": {
"directive": "returns",
"text": "Vector3\tThe unit vector of this vector.",
"type": "Vector3",
"description": "The unit vector of this vector."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.unit",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L232-L238"
}
volume 🔗
Calculates the volume of the region bounded by 2 points.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3 | nil | The first point bounding the target region. |
b | Vector3 | nil | The second point bounding the target region. |
Returns
number
:
The volume of the defined region.
Source
--- Calculates the volume of the region bounded by 2 points.
-- @param a Vector3 The first point bounding the target region.
-- @param b Vector3 The second point bounding the target region.
-- @returns number The volume of the defined region.
function Vector3.volume(a, b)
{
"type": "function",
"internal": false,
"description": "Calculates the volume of the region bounded by 2 points.",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe first point bounding the target region.",
"name": "a",
"type": "Vector3",
"description": "The first point bounding the target region."
},
{
"directive": "param",
"text": "b\t\tVector3\t\tThe second point bounding the target region.",
"name": "b",
"type": "Vector3",
"description": "The second point bounding the target region."
},
{
"directive": "returns",
"text": "number\tThe volume of the defined region.",
"type": "number",
"description": "The volume of the defined region."
}
],
"line": 175,
"namespace": "worldeditadditions_core.Vector3",
"line_last": 179,
"name": "volume",
"instanced": false,
"args": [
"a",
"b"
],
"text": "--- Calculates the volume of the region bounded by 2 points.\n-- @param\ta\t\tVector3\t\tThe first point bounding the target region.\n-- @param\tb\t\tVector3\t\tThe second point bounding the target region.\n-- @returns\tnumber\tThe volume of the defined region.\nfunction Vector3.volume(a, b)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3\t\tThe first point bounding the target region.",
"name": "a",
"type": "Vector3",
"description": "The first point bounding the target region."
},
{
"directive": "param",
"text": "b\t\tVector3\t\tThe second point bounding the target region.",
"name": "b",
"type": "Vector3",
"description": "The second point bounding the target region."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe volume of the defined region.",
"type": "number",
"description": "The volume of the defined region."
},
"examples": [],
"name_full": "worldeditadditions_core.Vector3.volume",
"filename": "worldeditadditions_core/utils/vector3.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/vector3.lua#L176-L180"
}
Functions
average 🔗
Calculates the mean of all the numbers in the given list.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
list | number[] | nil | The list (table) of numbers to calculate the mean for. |
Returns
The mean of the numbers in the given table.
Source
--- Calculates the mean of all the numbers in the given list.
-- @param list number[] The list (table) of numbers to calculate the mean for.
-- @returns The mean of the numbers in the given table.
function wea_c.average(list)
{
"type": "function",
"internal": false,
"description": "Calculates the mean of all the numbers in the given list.",
"directives": [
{
"directive": "param",
"text": "list\tnumber[]\tThe list (table) of numbers to calculate the mean for.",
"name": "list",
"type": "number[]",
"description": "The list (table) of numbers to calculate the mean for."
},
{
"directive": "returns",
"text": "The mean of the numbers in the given table.",
"type": "The mean of the numbers in the given table."
}
],
"line": 33,
"namespace": "worldeditadditions_core",
"line_last": 36,
"name": "average",
"instanced": false,
"args": [
"list"
],
"text": "--- Calculates the mean of all the numbers in the given list.\n-- @param\tlist\tnumber[]\tThe list (table) of numbers to calculate the mean for.\n-- @returns\tThe mean of the numbers in the given table.\nfunction wea_c.average(list)",
"params": [
{
"directive": "param",
"text": "list\tnumber[]\tThe list (table) of numbers to calculate the mean for.",
"name": "list",
"type": "number[]",
"description": "The list (table) of numbers to calculate the mean for."
}
],
"returns": {
"directive": "returns",
"text": "The mean of the numbers in the given table.",
"type": "The mean of the numbers in the given table."
},
"examples": [],
"name_full": "worldeditadditions_core.average",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L34-L37"
}
axis_left 🔗
Returns the axis and sign of the axis to the left of the input axis.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
axis | string | nil | x or z. |
sign | int | nil | Sign multiplier. |
Returns
string,int
:
Returns axis name and sign multiplier.
Source
--- Returns the axis and sign of the axis to the left of the input axis.
-- @deprecated Use wea_c.player_dir instead.
-- @param axis string x or z.
-- @param sign int Sign multiplier.
-- @return string,int Returns axis name and sign multiplier.
function wea_c.axis_left(axis,sign)
{
"type": "function",
"internal": false,
"description": "Returns the axis and sign of the axis to the left of the input axis.",
"directives": [
{
"directive": "deprecated",
"text": "Use wea_c.player_dir instead."
},
{
"directive": "param",
"text": "axis\tstring\tx or z.",
"name": "axis",
"type": "string",
"description": "x or z."
},
{
"directive": "param",
"text": "sign\tint\tSign multiplier.",
"name": "sign",
"type": "int",
"description": "Sign multiplier."
},
{
"directive": "returns",
"text": "string,int\tReturns axis name and sign multiplier.",
"type": "string,int",
"description": "Returns axis name and sign multiplier."
}
],
"line": 94,
"namespace": "worldeditadditions_core",
"line_last": 99,
"name": "axis_left",
"instanced": false,
"args": [
"axis",
"sign"
],
"text": "--- Returns the axis and sign of the axis to the left of the input axis.\n-- @deprecated\t\tUse wea_c.player_dir instead.\n-- @param\taxis\tstring\tx or z.\n-- @param sign\tint\tSign multiplier.\n-- @return\tstring,int\tReturns axis name and sign multiplier.\nfunction wea_c.axis_left(axis,sign)",
"params": [
{
"directive": "param",
"text": "axis\tstring\tx or z.",
"name": "axis",
"type": "string",
"description": "x or z."
},
{
"directive": "param",
"text": "sign\tint\tSign multiplier.",
"name": "sign",
"type": "int",
"description": "Sign multiplier."
}
],
"returns": {
"directive": "returns",
"text": "string,int\tReturns axis name and sign multiplier.",
"type": "string,int",
"description": "Returns axis name and sign multiplier."
},
"examples": [],
"name_full": "worldeditadditions_core.axis_left",
"filename": "worldeditadditions_core/utils/player.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/player.lua#L95-L100"
}
chaikin 🔗
Chaikin curve smoothing implementation. This algorithm works by taking a list of points that define a segmented line, and then interpolating between them to smooth the line.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
arr_pos | Vector3[] | nil | A list of points to interpolate. |
steps | number | nil | The number of interpolatioon passes to do. |
Returns
Vector3[]
:
A (longer) list of interpolated points.
Source
--- Chaikin curve smoothing implementation.
-- This algorithm works by taking a list of points that define a segmented line,
-- and then interpolating between them to smooth the line.
-- @source Ported from https://git.starbeamrainbowlabs.com/sbrl-GitLab/Chaikin-Generator/src/branch/master/ChaikinGenerator/ChaikinCurve.cs
-- @param arr_pos Vector3[] A list of points to interpolate.
-- @param steps number The number of interpolatioon passes to do.
-- @returns Vector3[] A (longer) list of interpolated points.
local function chaikin(arr_pos, steps)
{
"type": "function",
"internal": false,
"description": "Chaikin curve smoothing implementation.\nThis algorithm works by taking a list of points that define a segmented line,\nand then interpolating between them to smooth the line.",
"directives": [
{
"directive": "source",
"text": "Ported from https://git.starbeamrainbowlabs.com/sbrl-GitLab/Chaikin-Generator/src/branch/master/ChaikinGenerator/ChaikinCurve.cs"
},
{
"directive": "param",
"text": "arr_pos\t\tVector3[]\tA list of points to interpolate.",
"name": "arr_pos",
"type": "Vector3[]",
"description": "A list of points to interpolate."
},
{
"directive": "param",
"text": "steps\t\tnumber\t\tThe number of interpolatioon passes to do.",
"name": "steps",
"type": "number",
"description": "The number of interpolatioon passes to do."
},
{
"directive": "returns",
"text": "Vector3[]\tA (longer) list of interpolated points.",
"type": "Vector3[]",
"description": "A (longer) list of interpolated points."
}
],
"line": 17,
"namespace": "worldeditadditions_core",
"line_last": 24,
"name": "chaikin",
"instanced": false,
"args": [
"arr_pos",
"steps"
],
"text": "--- Chaikin curve smoothing implementation.\n-- This algorithm works by taking a list of points that define a segmented line,\n-- and then interpolating between them to smooth the line.\n-- @source Ported from https://git.starbeamrainbowlabs.com/sbrl-GitLab/Chaikin-Generator/src/branch/master/ChaikinGenerator/ChaikinCurve.cs\n-- @param\tarr_pos\t\tVector3[]\tA list of points to interpolate.\n-- @param\tsteps\t\tnumber\t\tThe number of interpolatioon passes to do.\n-- @returns\tVector3[]\tA (longer) list of interpolated points.\nlocal function chaikin(arr_pos, steps)",
"params": [
{
"directive": "param",
"text": "arr_pos\t\tVector3[]\tA list of points to interpolate.",
"name": "arr_pos",
"type": "Vector3[]",
"description": "A list of points to interpolate."
},
{
"directive": "param",
"text": "steps\t\tnumber\t\tThe number of interpolatioon passes to do.",
"name": "steps",
"type": "number",
"description": "The number of interpolatioon passes to do."
}
],
"returns": {
"directive": "returns",
"text": "Vector3[]\tA (longer) list of interpolated points.",
"type": "Vector3[]",
"description": "A (longer) list of interpolated points."
},
"examples": [],
"name_full": "worldeditadditions_core.chaikin",
"filename": "worldeditadditions_core/utils/chaikin.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/chaikin.lua#L18-L25"
}
clamp 🔗
Clamp a number to ensure it falls within a given range.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
value | number | nil | The value to clamp. |
min | number | nil | The minimum allowed value. |
max | number | nil | The maximum allowed value. |
Returns
number
:
The clamped number.
Source
--- Clamp a number to ensure it falls within a given range.
-- @param value number The value to clamp.
-- @param min number The minimum allowed value.
-- @param max number The maximum allowed value.
-- @returns number The clamped number.
function wea_c.clamp(value, min, max)
{
"type": "function",
"internal": false,
"description": "Clamp a number to ensure it falls within a given range.",
"directives": [
{
"directive": "param",
"text": "value\tnumber\tThe value to clamp.",
"name": "value",
"type": "number",
"description": "The value to clamp."
},
{
"directive": "param",
"text": "min\t\tnumber\tThe minimum allowed value.",
"name": "min",
"type": "number",
"description": "The minimum allowed value."
},
{
"directive": "param",
"text": "max\t\tnumber\tThe maximum allowed value.",
"name": "max",
"type": "number",
"description": "The maximum allowed value."
},
{
"directive": "returns",
"text": "number\tThe clamped number.",
"type": "number",
"description": "The clamped number."
}
],
"line": 107,
"namespace": "worldeditadditions_core",
"line_last": 112,
"name": "clamp",
"instanced": false,
"args": [
"value",
"min",
"max"
],
"text": "--- Clamp a number to ensure it falls within a given range.\n-- @param\tvalue\tnumber\tThe value to clamp.\n-- @param\tmin\t\tnumber\tThe minimum allowed value.\n-- @param\tmax\t\tnumber\tThe maximum allowed value.\n-- @returns\tnumber\tThe clamped number.\nfunction wea_c.clamp(value, min, max)",
"params": [
{
"directive": "param",
"text": "value\tnumber\tThe value to clamp.",
"name": "value",
"type": "number",
"description": "The value to clamp."
},
{
"directive": "param",
"text": "min\t\tnumber\tThe minimum allowed value.",
"name": "min",
"type": "number",
"description": "The minimum allowed value."
},
{
"directive": "param",
"text": "max\t\tnumber\tThe maximum allowed value.",
"name": "max",
"type": "number",
"description": "The maximum allowed value."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe clamped number.",
"type": "number",
"description": "The clamped number."
},
"examples": [],
"name_full": "worldeditadditions_core.clamp",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L108-L113"
}
command_exists 🔗
Returns whether a WorldEditAdditions (or WorldEdit) command exists with the given name. Note that this does NOT check for general Minetest chat commands - only commands registered through WorldEditAdditions or WorldEdit, if WorldEdit is currently loaded - the eventual plan is to make it an optional dependency.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
cmdname | string | nil | The name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type |
only_wea | bool | nil | If true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit. |
Returns
bool
:
Whether a WorldEdit/WorldEditAdditions command exists with the given name.
Source
--- Returns whether a WorldEditAdditions (or WorldEdit) command exists with the given name.
-- Note that this does NOT check for general Minetest chat commands - only commands registered through WorldEditAdditions or WorldEdit, if WorldEdit is currently loaded - the eventual plan is to make it an optional dependency.
-- @param cmdname string The name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists("/layers")`.
-- @param only_wea bool If true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit.
-- @returns bool Whether a WorldEdit/WorldEditAdditions command exists with the given name.
local function command_exists(cmdname, only_wea)
{
"type": "function",
"internal": false,
"description": "Returns whether a WorldEditAdditions (or WorldEdit) command exists with the given name.\nNote that this does NOT check for general Minetest chat commands - only commands registered through WorldEditAdditions or WorldEdit, if WorldEdit is currently loaded - the eventual plan is to make it an optional dependency.",
"directives": [
{
"directive": "param",
"text": "cmdname\t\tstring\tThe name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists(\"/layers\")`.",
"name": "cmdname",
"type": "string",
"description": "The name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists(\"/layers\")`."
},
{
"directive": "param",
"text": "only_wea\tbool\tIf true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit.",
"name": "only_wea",
"type": "bool",
"description": "If true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit."
},
{
"directive": "returns",
"text": "bool\t\tWhether a WorldEdit/WorldEditAdditions command exists with the given name.",
"type": "bool",
"description": "Whether a WorldEdit/WorldEditAdditions command exists with the given name."
}
],
"line": 5,
"namespace": "worldeditadditions_core",
"line_last": 10,
"name": "command_exists",
"instanced": false,
"args": [
"cmdname",
"only_wea"
],
"text": "--- Returns whether a WorldEditAdditions (or WorldEdit) command exists with the given name.\n-- Note that this does NOT check for general Minetest chat commands - only commands registered through WorldEditAdditions or WorldEdit, if WorldEdit is currently loaded - the eventual plan is to make it an optional dependency.\n-- @param\tcmdname\t\tstring\tThe name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists(\"/layers\")`.\n-- @param\tonly_wea\tbool\tIf true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit.\n-- @returns\tbool\t\tWhether a WorldEdit/WorldEditAdditions command exists with the given name.\nlocal function command_exists(cmdname, only_wea)",
"params": [
{
"directive": "param",
"text": "cmdname\t\tstring\tThe name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists(\"/layers\")`.",
"name": "cmdname",
"type": "string",
"description": "The name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists(\"/layers\")`."
},
{
"directive": "param",
"text": "only_wea\tbool\tIf true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit.",
"name": "only_wea",
"type": "bool",
"description": "If true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit."
}
],
"returns": {
"directive": "returns",
"text": "bool\t\tWhether a WorldEdit/WorldEditAdditions command exists with the given name.",
"type": "bool",
"description": "Whether a WorldEdit/WorldEditAdditions command exists with the given name."
},
"examples": [],
"name_full": "worldeditadditions_core.command_exists",
"filename": "worldeditadditions_core/core/command_exists.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/command_exists.lua#L6-L11"
}
dir_to_xyz 🔗
Dehumanize Direction: translates up, down, left, right, front, into xyz based on player orientation.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to return facing direction of. |
dir | string | nil | Relative direction to translate. |
Returns
string
:
Returns axis name and sign multiplier.
Source
--- Dehumanize Direction: translates up, down, left, right, front, into xyz based on player orientation.
-- @deprecated Use wea_c.player_dir instead.
-- @param name string The name of the player to return facing direction of.
-- @param dir string Relative direction to translate.
-- @return string Returns axis name and sign multiplier.
function wea_c.dir_to_xyz(name, dir)
{
"type": "function",
"internal": false,
"description": "Dehumanize Direction: translates up, down, left, right, front, into xyz based on player orientation.",
"directives": [
{
"directive": "deprecated",
"text": "Use wea_c.player_dir instead."
},
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
},
{
"directive": "param",
"text": "dir\tstring\tRelative direction to translate.",
"name": "dir",
"type": "string",
"description": "Relative direction to translate."
},
{
"directive": "returns",
"text": "string\tReturns axis name and sign multiplier.",
"type": "string",
"description": "Returns axis name and sign multiplier."
}
],
"line": 105,
"namespace": "worldeditadditions_core",
"line_last": 110,
"name": "dir_to_xyz",
"instanced": false,
"args": [
"name",
"dir"
],
"text": "--- Dehumanize Direction: translates up, down, left, right, front, into xyz based on player orientation.\n-- @deprecated\t\tUse wea_c.player_dir instead.\n-- @param\tname\tstring\tThe name of the player to return facing direction of.\n-- @param\tdir\tstring\tRelative direction to translate.\n-- @return\tstring\tReturns axis name and sign multiplier.\nfunction wea_c.dir_to_xyz(name, dir)",
"params": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
},
{
"directive": "param",
"text": "dir\tstring\tRelative direction to translate.",
"name": "dir",
"type": "string",
"description": "Relative direction to translate."
}
],
"returns": {
"directive": "returns",
"text": "string\tReturns axis name and sign multiplier.",
"type": "string",
"description": "Returns axis name and sign multiplier."
},
"examples": [],
"name_full": "worldeditadditions_core.dir_to_xyz",
"filename": "worldeditadditions_core/utils/player.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/player.lua#L106-L111"
}
emerge_area 🔗
Loads the area defined by the specified region using minetest.emerge_area. Unlike minetest.emerge_area, this command calls the specified callback only once upon completion.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
{Vector} | pos1 | nil | The first position defining the area to emerge. |
{Vector} | pos2 | nil | The second position defining the area to emerge. |
{function} | callback | nil | The callback to call when the emerging process is complete. |
{any} | callback_state | nil | A state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object) |
Returns
nil
Source
--- Loads the area defined by the specified region using minetest.emerge_area.
-- Unlike minetest.emerge_area, this command calls the specified callback only
-- once upon completion.
-- @param {Vector} pos1 The first position defining the area to emerge.
-- @param {Vector} pos2 The second position defining the area to emerge.
-- @param {function} callback The callback to call when the emerging process is complete.
-- @param {any} callback_state A state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object)
function wea_c.emerge_area(pos1, pos2, callback, callback_state)
{
"type": "function",
"internal": false,
"description": "Loads the area defined by the specified region using minetest.emerge_area.\nUnlike minetest.emerge_area, this command calls the specified callback only\nonce upon completion.",
"directives": [
{
"directive": "param",
"text": "{Vector}\tpos1\t\tThe first position defining the area to emerge.",
"name": "{Vector}",
"type": "pos1",
"description": "The first position defining the area to emerge."
},
{
"directive": "param",
"text": "{Vector}\tpos2\t\tThe second position defining the area to emerge.",
"name": "{Vector}",
"type": "pos2",
"description": "The second position defining the area to emerge."
},
{
"directive": "param",
"text": "{function}\tcallback\tThe callback to call when the emerging process is complete.",
"name": "{function}",
"type": "callback",
"description": "The callback to call when the emerging process is complete."
},
{
"directive": "param",
"text": "{any}\t\tcallback_state\tA state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object)",
"name": "{any}",
"type": "callback_state",
"description": "A state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object)"
}
],
"line": 81,
"namespace": "worldeditadditions_core",
"line_last": 88,
"name": "emerge_area",
"instanced": false,
"args": [
"pos1",
"pos2",
"callback",
"callback_state"
],
"text": "--- Loads the area defined by the specified region using minetest.emerge_area.\n-- Unlike minetest.emerge_area, this command calls the specified callback only\n-- once upon completion.\n-- @param\t{Vector}\tpos1\t\tThe first position defining the area to emerge.\n-- @param\t{Vector}\tpos2\t\tThe second position defining the area to emerge.\n-- @param\t{function}\tcallback\tThe callback to call when the emerging process is complete.\n-- @param\t{any}\t\tcallback_state\tA state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object)\nfunction wea_c.emerge_area(pos1, pos2, callback, callback_state)",
"params": [
{
"directive": "param",
"text": "{Vector}\tpos1\t\tThe first position defining the area to emerge.",
"name": "{Vector}",
"type": "pos1",
"description": "The first position defining the area to emerge."
},
{
"directive": "param",
"text": "{Vector}\tpos2\t\tThe second position defining the area to emerge.",
"name": "{Vector}",
"type": "pos2",
"description": "The second position defining the area to emerge."
},
{
"directive": "param",
"text": "{function}\tcallback\tThe callback to call when the emerging process is complete.",
"name": "{function}",
"type": "callback",
"description": "The callback to call when the emerging process is complete."
},
{
"directive": "param",
"text": "{any}\t\tcallback_state\tA state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object)",
"name": "{any}",
"type": "callback_state",
"description": "A state object to pass to the callback as a 2nd parameter (the 1st parameter is the emerge_area progress tracking state object)"
}
],
"examples": [],
"name_full": "worldeditadditions_core.emerge_area",
"filename": "worldeditadditions_core/utils/nodes.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/nodes.lua#L82-L89"
}
escape 🔗
Escape the given string for use in a url. In other words, like a space turns into %20. Similar to Javascript's encodeURIComponent()
.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
string | str | nil | The string to escape. |
Returns
string
:
The escaped string.
Source
--- Escape the given string for use in a url.
-- In other words, like a space turns into %20.
-- Similar to Javascript's `encodeURIComponent()`.
-- @param string str The string to escape.
-- @returns string The escaped string.
local function escape(str)
{
"type": "function",
"internal": false,
"description": "Escape the given string for use in a url.\nIn other words, like a space turns into %20.\nSimilar to Javascript's `encodeURIComponent()`.",
"directives": [
{
"directive": "param",
"text": "string\tstr\t\tThe string to escape.",
"name": "string",
"type": "str",
"description": "The string to escape."
},
{
"directive": "returns",
"text": "string\tThe escaped string.",
"type": "string",
"description": "The escaped string."
}
],
"line": 15,
"namespace": "worldeditadditions_core",
"line_last": 20,
"name": "escape",
"instanced": false,
"args": [
"str"
],
"text": "--- Escape the given string for use in a url.\n-- In other words, like a space turns into %20.\n-- Similar to Javascript's `encodeURIComponent()`.\n-- @param\tstring\tstr\t\tThe string to escape.\n-- @returns\tstring\tThe escaped string.\nlocal function escape(str)",
"params": [
{
"directive": "param",
"text": "string\tstr\t\tThe string to escape.",
"name": "string",
"type": "str",
"description": "The string to escape."
}
],
"returns": {
"directive": "returns",
"text": "string\tThe escaped string.",
"type": "string",
"description": "The escaped string."
},
"examples": [],
"name_full": "worldeditadditions_core.escape",
"filename": "worldeditadditions_core/utils/format/escape.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/format/escape.lua#L16-L21"
}
eta 🔗
Calculates the estimated time remaining from a list of times. Intended to be used where one has a number of works units, and one has a list of how long the most recent units have taken to run.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
existing_times | number[] | nil | A list of times - in ms - that the most recent work units have taken. |
done_count | number | nil | The number of work units completed so far. |
total_count | number | nil | The total number of work units to be completed. |
Returns
nil
Source
--- Calculates the estimated time remaining from a list of times.
-- Intended to be used where one has a number of works units, and one has a
-- list of how long the most recent units have taken to run.
-- @param existing_times number[] A list of times - in ms - that the most recent work units have taken.
-- @param done_count number The number of work units completed so far.
-- @param total_count number The total number of work units to be completed.
function wea_c.eta(existing_times, done_count, total_count)
{
"type": "function",
"internal": false,
"description": "Calculates the estimated time remaining from a list of times.\nIntended to be used where one has a number of works units, and one has a\nlist of how long the most recent units have taken to run.",
"directives": [
{
"directive": "param",
"text": "existing_times\tnumber[]\tA list of times - in ms - that the most recent work units have taken.",
"name": "existing_times",
"type": "number[]",
"description": "A list of times - in ms - that the most recent work units have taken."
},
{
"directive": "param",
"text": "done_count\t\tnumber\t\tThe number of work units completed so far.",
"name": "done_count",
"type": "number",
"description": "The number of work units completed so far."
},
{
"directive": "param",
"text": "total_count\t\tnumber\t\tThe total number of work units to be completed.",
"name": "total_count",
"type": "number",
"description": "The total number of work units to be completed."
}
],
"line": 79,
"namespace": "worldeditadditions_core",
"line_last": 85,
"name": "eta",
"instanced": false,
"args": [
"existing_times",
"done_count",
"total_count"
],
"text": "--- Calculates the estimated time remaining from a list of times.\n-- Intended to be used where one has a number of works units, and one has a\n-- list of how long the most recent units have taken to run.\n-- @param\texisting_times\tnumber[]\tA list of times - in ms - that the most recent work units have taken.\n-- @param\tdone_count\t\tnumber\t\tThe number of work units completed so far.\n-- @param\ttotal_count\t\tnumber\t\tThe total number of work units to be completed.\nfunction wea_c.eta(existing_times, done_count, total_count)",
"params": [
{
"directive": "param",
"text": "existing_times\tnumber[]\tA list of times - in ms - that the most recent work units have taken.",
"name": "existing_times",
"type": "number[]",
"description": "A list of times - in ms - that the most recent work units have taken."
},
{
"directive": "param",
"text": "done_count\t\tnumber\t\tThe number of work units completed so far.",
"name": "done_count",
"type": "number",
"description": "The number of work units completed so far."
},
{
"directive": "param",
"text": "total_count\t\tnumber\t\tThe total number of work units to be completed.",
"name": "total_count",
"type": "number",
"description": "The total number of work units to be completed."
}
],
"examples": [],
"name_full": "worldeditadditions_core.eta",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L80-L86"
}
fetch_command_def 🔗
Fetches the definition of a WorldEditAdditions or WorldEdit command Does not support fetching generic Minetest commands - check minetest.registered_chatcommands for this.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
cmdname | string | nil | The name of the command to fetch the definition for. |
Returns
nil
Source
--- Fetches the definition of a WorldEditAdditions or WorldEdit command
-- Does not support fetching generic Minetest commands - check
-- minetest.registered_chatcommands for this.
-- @param cmdname string The name of the command to fetch the definition for.
local function fetch_command_def(cmdname)
{
"type": "function",
"internal": false,
"description": "Fetches the definition of a WorldEditAdditions or WorldEdit command\nDoes not support fetching generic Minetest commands - check\nminetest.registered_chatcommands for this.",
"directives": [
{
"directive": "param",
"text": "cmdname\t\tstring\t\tThe name of the command to fetch the definition for.",
"name": "cmdname",
"type": "string",
"description": "The name of the command to fetch the definition for."
}
],
"line": 4,
"namespace": "worldeditadditions_core",
"line_last": 8,
"name": "fetch_command_def",
"instanced": false,
"args": [
"cmdname"
],
"text": "--- Fetches the definition of a WorldEditAdditions or WorldEdit command\n-- Does not support fetching generic Minetest commands - check\n-- minetest.registered_chatcommands for this.\n-- @param\tcmdname\t\tstring\t\tThe name of the command to fetch the definition for.\nlocal function fetch_command_def(cmdname)",
"params": [
{
"directive": "param",
"text": "cmdname\t\tstring\t\tThe name of the command to fetch the definition for.",
"name": "cmdname",
"type": "string",
"description": "The name of the command to fetch the definition for."
}
],
"examples": [],
"name_full": "worldeditadditions_core.fetch_command_def",
"filename": "worldeditadditions_core/core/fetch_command_def.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/fetch_command_def.lua#L5-L9"
}
get_all_sapling_aliases 🔗
Returns the current key ⇒ value table of sapling names and aliases.
Arguments
This function takes no arguments.
Returns
table
Source
--- Returns the current key ⇒ value table of sapling names and aliases.
-- @return table
function wea_c.get_all_sapling_aliases()
{
"type": "function",
"internal": false,
"description": "Returns the current key ⇒ value table of sapling names and aliases.",
"directives": [
{
"directive": "returns",
"text": "table",
"type": "table"
}
],
"line": 109,
"namespace": "worldeditadditions_core",
"line_last": 111,
"name": "get_all_sapling_aliases",
"instanced": false,
"args": [
""
],
"text": "--- Returns the current key ⇒ value table of sapling names and aliases.\n-- @return\ttable\nfunction wea_c.get_all_sapling_aliases()",
"params": [],
"returns": {
"directive": "returns",
"text": "table",
"type": "table"
},
"examples": [],
"name_full": "worldeditadditions_core.get_all_sapling_aliases",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L110-L112"
}
get_ms_time 🔗
Returns the minetest.get_us_time() in ms
Arguments
This function takes no arguments.
Returns
float
Source
--- Returns the minetest.get_us_time() in ms
-- @return float
function wea_c.get_ms_time()
{
"type": "function",
"internal": false,
"description": "Returns the minetest.get_us_time() in ms",
"directives": [
{
"directive": "returns",
"text": "float",
"type": "float"
}
],
"line": 73,
"namespace": "worldeditadditions_core",
"line_last": 75,
"name": "get_ms_time",
"instanced": false,
"args": [
""
],
"text": "--- Returns the minetest.get_us_time() in ms\n-- @return\tfloat\nfunction wea_c.get_ms_time()",
"params": [],
"returns": {
"directive": "returns",
"text": "float",
"type": "float"
},
"examples": [],
"name_full": "worldeditadditions_core.get_ms_time",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L74-L76"
}
getsign 🔗
Returns the sign (+ or -) at the beginning of a string if present.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
src | string|int | nil | Input string. |
Returns
string|int
:
Returns the signed multiplier (1|-1).
Source
--- Returns the sign (+ or -) at the beginning of a string if present.
-- @param src string|int Input string.
-- @return string|int Returns the signed multiplier (1|-1).
function wea_c.getsign(src)
{
"type": "function",
"internal": false,
"description": "Returns the sign (+ or -) at the beginning of a string if present.",
"directives": [
{
"directive": "param",
"text": "src\tstring|int\tInput string.",
"name": "src",
"type": "string|int",
"description": "Input string."
},
{
"directive": "returns",
"text": "string|int\tReturns the signed multiplier (1|-1).",
"type": "string|int",
"description": "Returns the signed multiplier (1|-1)."
}
],
"line": 95,
"namespace": "worldeditadditions_core",
"line_last": 98,
"name": "getsign",
"instanced": false,
"args": [
"src"
],
"text": "--- Returns the sign (+ or -) at the beginning of a string if present.\n-- @param\tsrc\tstring|int\tInput string.\n-- @return\tstring|int\tReturns the signed multiplier (1|-1).\nfunction wea_c.getsign(src)",
"params": [
{
"directive": "param",
"text": "src\tstring|int\tInput string.",
"name": "src",
"type": "string|int",
"description": "Input string."
}
],
"returns": {
"directive": "returns",
"text": "string|int\tReturns the signed multiplier (1|-1).",
"type": "string|int",
"description": "Returns the signed multiplier (1|-1)."
},
"examples": [],
"name_full": "worldeditadditions_core.getsign",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L96-L99"
}
handle_fn_result 🔗
Handles the result of a function call.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
... | any | nil | The full output of the function call. |
Returns
nil
Source
--- Handles the result of a function call.
--- @param ... any The full output of the function call.
local function handle_fn_result(...)
{
"type": "function",
"internal": false,
"description": "Handles the result of a function call.",
"directives": [
{
"directive": "param",
"text": "...\tany\t\tThe full output of the function call.",
"name": "...",
"type": "any",
"description": "The full output of the function call."
}
],
"line": 4,
"namespace": "worldeditadditions_core",
"line_last": 6,
"name": "handle_fn_result",
"instanced": false,
"args": [
"..."
],
"text": "--- Handles the result of a function call.\n--- @param\t...\tany\t\tThe full output of the function call.\nlocal function handle_fn_result(...)",
"params": [
{
"directive": "param",
"text": "...\tany\t\tThe full output of the function call.",
"name": "...",
"type": "any",
"description": "The full output of the function call."
}
],
"examples": [],
"name_full": "worldeditadditions_core.handle_fn_result",
"filename": "worldeditadditions_commands/commands/test/helpers/handle_fn_result.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_commands/commands/test/helpers/handle_fn_result.lua#L5-L7"
}
handle_success_resultmsg 🔗
Handles the success bool and result message string that a command's main func
returns.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
success | bool | nil | Whether the command executed successfully or not. |
result_message | string | nil | The message (as a string) to send to the player. |
Returns
nil
Source
--- Handles the success bool and result message string that a command's main `func` returns.
-- @param success bool Whether the command executed successfully or not.
-- @param result_message string The message (as a string) to send to the player.
local function handle_success_resultmsg(player_name, cmdname, success, result_message)
{
"type": "function",
"internal": false,
"description": "Handles the success bool and result message string that a command's main `func` returns.",
"directives": [
{
"directive": "param",
"text": "success\tbool\tWhether the command executed successfully or not.",
"name": "success",
"type": "bool",
"description": "Whether the command executed successfully or not."
},
{
"directive": "param",
"text": "result_message\tstring\tThe message (as a string) to send to the player.",
"name": "result_message",
"type": "string",
"description": "The message (as a string) to send to the player."
}
],
"line": 9,
"namespace": "worldeditadditions_core",
"line_last": 12,
"name": "handle_success_resultmsg",
"instanced": false,
"args": [
"player_name",
"cmdname",
"success",
"result_message"
],
"text": "--- Handles the success bool and result message string that a command's main `func` returns.\n-- @param success\tbool\tWhether the command executed successfully or not.\n-- @param result_message\tstring\tThe message (as a string) to send to the player.\nlocal function handle_success_resultmsg(player_name, cmdname, success, result_message)",
"params": [
{
"directive": "param",
"text": "success\tbool\tWhether the command executed successfully or not.",
"name": "success",
"type": "bool",
"description": "Whether the command executed successfully or not."
},
{
"directive": "param",
"text": "result_message\tstring\tThe message (as a string) to send to the player.",
"name": "result_message",
"type": "string",
"description": "The message (as a string) to send to the player."
}
],
"examples": [],
"name_full": "worldeditadditions_core.handle_success_resultmsg",
"filename": "worldeditadditions_core/core/run_command.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/run_command.lua#L10-L13"
}
inspect 🔗
Serialises an arbitrary value to a string. Note that although the resulting table looks like valid Lua, it isn't. Completely arbitrarily, if a table (or it's associated metatable) has the key __name then it is conidered the name of the parent metatable. This can be useful for identifying custom table-based types. Should anyone come across a 'proper' way to obtain the name of a metatable in pure vanilla Lua, I will update this to follow that standard instead.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
item | any | nil | Input item to serialise. |
sep | string | nil | key value seperator |
new_line | string | nil | key value pair delimiter |
Returns
string
:
concatenated table pairs
Source
--- Serialises an arbitrary value to a string.
-- Note that although the resulting table *looks* like valid Lua, it isn't.
-- Completely arbitrarily, if a table (or it's associated metatable) has the
-- key __name then it is conidered the name of the parent metatable. This can
-- be useful for identifying custom table-based types.
-- Should anyone come across a 'proper' way to obtain the name of a metatable
-- in pure vanilla Lua, I will update this to follow that standard instead.
-- @param item any Input item to serialise.
-- @param sep string key value seperator
-- @param new_line string key value pair delimiter
-- @return string concatenated table pairs
local function inspect(item, maxdepth)
{
"type": "function",
"internal": false,
"description": "Serialises an arbitrary value to a string.\nNote that although the resulting table *looks* like valid Lua, it isn't.\nCompletely arbitrarily, if a table (or it's associated metatable) has the\nkey __name then it is conidered the name of the parent metatable. This can\nbe useful for identifying custom table-based types.\nShould anyone come across a 'proper' way to obtain the name of a metatable\nin pure vanilla Lua, I will update this to follow that standard instead.",
"directives": [
{
"directive": "param",
"text": "item\t\tany\t\tInput item to serialise.",
"name": "item",
"type": "any",
"description": "Input item to serialise."
},
{
"directive": "param",
"text": "sep\t\t\tstring\tkey value seperator",
"name": "sep",
"type": "string",
"description": "key value seperator"
},
{
"directive": "param",
"text": "new_line\tstring\tkey value pair delimiter",
"name": "new_line",
"type": "string",
"description": "key value pair delimiter"
},
{
"directive": "returns",
"text": "string\tconcatenated table pairs",
"type": "string",
"description": "concatenated table pairs"
}
],
"line": 9,
"namespace": "worldeditadditions_core",
"line_last": 20,
"name": "inspect",
"instanced": false,
"args": [
"item",
"maxdepth"
],
"text": "--- Serialises an arbitrary value to a string.\n-- Note that although the resulting table *looks* like valid Lua, it isn't.\n-- Completely arbitrarily, if a table (or it's associated metatable) has the\n-- key __name then it is conidered the name of the parent metatable. This can\n-- be useful for identifying custom table-based types.\n-- Should anyone come across a 'proper' way to obtain the name of a metatable\n-- in pure vanilla Lua, I will update this to follow that standard instead.\n-- @param\titem\t\tany\t\tInput item to serialise.\n-- @param\tsep\t\t\tstring\tkey value seperator\n-- @param\tnew_line\tstring\tkey value pair delimiter\n-- @return\tstring\tconcatenated table pairs\nlocal function inspect(item, maxdepth)",
"params": [
{
"directive": "param",
"text": "item\t\tany\t\tInput item to serialise.",
"name": "item",
"type": "any",
"description": "Input item to serialise."
},
{
"directive": "param",
"text": "sep\t\t\tstring\tkey value seperator",
"name": "sep",
"type": "string",
"description": "key value seperator"
},
{
"directive": "param",
"text": "new_line\tstring\tkey value pair delimiter",
"name": "new_line",
"type": "string",
"description": "key value pair delimiter"
}
],
"returns": {
"directive": "returns",
"text": "string\tconcatenated table pairs",
"type": "string",
"description": "concatenated table pairs"
},
"examples": [],
"name_full": "worldeditadditions_core.inspect",
"filename": "worldeditadditions_core/utils/inspect.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/inspect.lua#L10-L21"
}
is_airlike 🔗
Determines whether the given node/content id is an airlike node or not. It is recommended that the result of this function be cached.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
id | number | nil | The content/node id to check. |
Returns
bool
:
Whether the given node/content id is an airlike node or not.
Source
--- Determines whether the given node/content id is an airlike node or not.
-- It is recommended that the result of this function be cached.
-- @param id number The content/node id to check.
-- @return bool Whether the given node/content id is an airlike node or not.
function wea_c.is_airlike(id)
{
"type": "function",
"internal": false,
"description": "Determines whether the given node/content id is an airlike node or not.\nIt is recommended that the result of this function be cached.",
"directives": [
{
"directive": "param",
"text": "id\t\tnumber\tThe content/node id to check.",
"name": "id",
"type": "number",
"description": "The content/node id to check."
},
{
"directive": "returns",
"text": "bool\tWhether the given node/content id is an airlike node or not.",
"type": "bool",
"description": "Whether the given node/content id is an airlike node or not."
}
],
"line": 8,
"namespace": "worldeditadditions_core",
"line_last": 12,
"name": "is_airlike",
"instanced": false,
"args": [
"id"
],
"text": "--- Determines whether the given node/content id is an airlike node or not.\n-- It is recommended that the result of this function be cached.\n-- @param\tid\t\tnumber\tThe content/node id to check.\n-- @return\tbool\tWhether the given node/content id is an airlike node or not.\nfunction wea_c.is_airlike(id)",
"params": [
{
"directive": "param",
"text": "id\t\tnumber\tThe content/node id to check.",
"name": "id",
"type": "number",
"description": "The content/node id to check."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the given node/content id is an airlike node or not.",
"type": "bool",
"description": "Whether the given node/content id is an airlike node or not."
},
"examples": [],
"name_full": "worldeditadditions_core.is_airlike",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L9-L13"
}
is_liquidlike 🔗
Determines whether the given node/content id is a liquid-ish node or not. It is recommended that the result of this function be cached.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
id | number | nil | The content/node id to check. |
Returns
bool
:
Whether the given node/content id is a liquid-ish node or not.
Source
--- Determines whether the given node/content id is a liquid-ish node or not.
-- It is recommended that the result of this function be cached.
-- @param id number The content/node id to check.
-- @return bool Whether the given node/content id is a liquid-ish node or not.
function wea_c.is_liquidlike(id)
{
"type": "function",
"internal": false,
"description": "Determines whether the given node/content id is a liquid-ish node or not.\nIt is recommended that the result of this function be cached.",
"directives": [
{
"directive": "param",
"text": "id\t\tnumber\tThe content/node id to check.",
"name": "id",
"type": "number",
"description": "The content/node id to check."
},
{
"directive": "returns",
"text": "bool\tWhether the given node/content id is a liquid-ish node or not.",
"type": "bool",
"description": "Whether the given node/content id is a liquid-ish node or not."
}
],
"line": 39,
"namespace": "worldeditadditions_core",
"line_last": 43,
"name": "is_liquidlike",
"instanced": false,
"args": [
"id"
],
"text": "--- Determines whether the given node/content id is a liquid-ish node or not.\n-- It is recommended that the result of this function be cached.\n-- @param\tid\t\tnumber\tThe content/node id to check.\n-- @return\tbool\tWhether the given node/content id is a liquid-ish node or not.\nfunction wea_c.is_liquidlike(id)",
"params": [
{
"directive": "param",
"text": "id\t\tnumber\tThe content/node id to check.",
"name": "id",
"type": "number",
"description": "The content/node id to check."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the given node/content id is a liquid-ish node or not.",
"type": "bool",
"description": "Whether the given node/content id is a liquid-ish node or not."
},
"examples": [],
"name_full": "worldeditadditions_core.is_liquidlike",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L40-L44"
}
is_sapling 🔗
Determines whether the given node/content id is a sapling or not. Nodes with the "sapling" group are considered saplings. It is recommended that the result of this function be cached.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
id | number | nil | The content/node id to check. |
Returns
bool
:
Whether the given node/content id is a sapling or not.
Source
--- Determines whether the given node/content id is a sapling or not.
-- Nodes with the "sapling" group are considered saplings.
-- It is recommended that the result of this function be cached.
-- @param id number The content/node id to check.
-- @return bool Whether the given node/content id is a sapling or not.
function wea_c.is_sapling(id)
{
"type": "function",
"internal": false,
"description": "Determines whether the given node/content id is a sapling or not.\nNodes with the \"sapling\" group are considered saplings.\nIt is recommended that the result of this function be cached.",
"directives": [
{
"directive": "param",
"text": "id\t\tnumber\tThe content/node id to check.",
"name": "id",
"type": "number",
"description": "The content/node id to check."
},
{
"directive": "returns",
"text": "bool\tWhether the given node/content id is a sapling or not.",
"type": "bool",
"description": "Whether the given node/content id is a sapling or not."
}
],
"line": 58,
"namespace": "worldeditadditions_core",
"line_last": 63,
"name": "is_sapling",
"instanced": false,
"args": [
"id"
],
"text": "--- Determines whether the given node/content id is a sapling or not.\n-- Nodes with the \"sapling\" group are considered saplings.\n-- It is recommended that the result of this function be cached.\n-- @param\tid\t\tnumber\tThe content/node id to check.\n-- @return\tbool\tWhether the given node/content id is a sapling or not.\nfunction wea_c.is_sapling(id)",
"params": [
{
"directive": "param",
"text": "id\t\tnumber\tThe content/node id to check.",
"name": "id",
"type": "number",
"description": "The content/node id to check."
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether the given node/content id is a sapling or not.",
"type": "bool",
"description": "Whether the given node/content id is a sapling or not."
},
"examples": [],
"name_full": "worldeditadditions_core.is_sapling",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L59-L64"
}
linear_interpolate 🔗
Interpolates between the 2 given points
TODO: refactor numbers.lua and move this function into there instead
Arguments
Name | Type | Default value | Description |
---|---|---|---|
a | Vector3|number | nil | The starting point. |
b | Vector3|number | nil | The ending point. |
time | number | nil | The percentage between 0 and 1 to interpolate to. |
Returns
Vector3|number
:
The interpolated point.
Source
--- Interpolates between the 2 given points
--
-- TODO: refactor numbers.lua and move this function into there instead
-- @param a Vector3|number The starting point.
-- @param b Vector3|number The ending point.
-- @param time number The percentage between 0 and 1 to interpolate to.
-- @returns Vector3|number The interpolated point.
local function linear_interpolate(a, b, time)
{
"type": "function",
"internal": false,
"description": "Interpolates between the 2 given points\n\nTODO: refactor numbers.lua and move this function into there instead",
"directives": [
{
"directive": "param",
"text": "a\t\tVector3|number\t\tThe starting point.",
"name": "a",
"type": "Vector3|number",
"description": "The starting point."
},
{
"directive": "param",
"text": "b\t\tVector3|number\t\tThe ending point.",
"name": "b",
"type": "Vector3|number",
"description": "The ending point."
},
{
"directive": "param",
"text": "time\tnumber\t\t\t\tThe percentage between 0 and 1 to interpolate to.",
"name": "time",
"type": "number",
"description": "The percentage between 0 and 1 to interpolate to."
},
{
"directive": "returns",
"text": "Vector3|number\t\t\t\tThe interpolated point.",
"type": "Vector3|number",
"description": "The interpolated point."
}
],
"line": 6,
"namespace": "worldeditadditions_core",
"line_last": 13,
"name": "linear_interpolate",
"instanced": false,
"args": [
"a",
"b",
"time"
],
"text": "--- Interpolates between the 2 given points\n-- \n-- TODO: refactor numbers.lua and move this function into there instead\n-- @param\ta\t\tVector3|number\t\tThe starting point.\n-- @param\tb\t\tVector3|number\t\tThe ending point.\n-- @param\ttime\tnumber\t\t\t\tThe percentage between 0 and 1 to interpolate to.\n-- @returns\tVector3|number\t\t\t\tThe interpolated point.\nlocal function linear_interpolate(a, b, time)",
"params": [
{
"directive": "param",
"text": "a\t\tVector3|number\t\tThe starting point.",
"name": "a",
"type": "Vector3|number",
"description": "The starting point."
},
{
"directive": "param",
"text": "b\t\tVector3|number\t\tThe ending point.",
"name": "b",
"type": "Vector3|number",
"description": "The ending point."
},
{
"directive": "param",
"text": "time\tnumber\t\t\t\tThe percentage between 0 and 1 to interpolate to.",
"name": "time",
"type": "number",
"description": "The percentage between 0 and 1 to interpolate to."
}
],
"returns": {
"directive": "returns",
"text": "Vector3|number\t\t\t\tThe interpolated point.",
"type": "Vector3|number",
"description": "The interpolated point."
},
"examples": [],
"name_full": "worldeditadditions_core.linear_interpolate",
"filename": "worldeditadditions_core/utils/chaikin.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/chaikin.lua#L7-L14"
}
max 🔗
Finds the maximum value in the given list.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
list | number[] | nil | The list (table) of numbers to find the maximum value of. |
Returns
number
:
The maximum value in the given list.
Source
--- Finds the maximum value in the given list.
-- @param list number[] The list (table) of numbers to find the maximum value of.
-- @returns number The maximum value in the given list.
function wea_c.max(list)
{
"type": "function",
"internal": false,
"description": "Finds the maximum value in the given list.",
"directives": [
{
"directive": "param",
"text": "list\tnumber[]\tThe list (table) of numbers to find the maximum value of.",
"name": "list",
"type": "number[]",
"description": "The list (table) of numbers to find the maximum value of."
},
{
"directive": "returns",
"text": "number\tThe maximum value in the given list.",
"type": "number",
"description": "The maximum value in the given list."
}
],
"line": 55,
"namespace": "worldeditadditions_core",
"line_last": 58,
"name": "max",
"instanced": false,
"args": [
"list"
],
"text": "--- Finds the maximum value in the given list.\n-- @param\tlist\tnumber[]\tThe list (table) of numbers to find the maximum value of.\n-- @returns\tnumber\tThe maximum value in the given list.\nfunction wea_c.max(list)",
"params": [
{
"directive": "param",
"text": "list\tnumber[]\tThe list (table) of numbers to find the maximum value of.",
"name": "list",
"type": "number[]",
"description": "The list (table) of numbers to find the maximum value of."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe maximum value in the given list.",
"type": "number",
"description": "The maximum value in the given list."
},
"examples": [],
"name_full": "worldeditadditions_core.max",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L56-L59"
}
min 🔗
Finds the minimum value in the given list.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
list | number[] | nil | The list (table) of numbers to find the minimum value of. |
Returns
number
:
The minimum value in the given list.
Source
--- Finds the minimum value in the given list.
-- @param list number[] The list (table) of numbers to find the minimum value of.
-- @returns number The minimum value in the given list.
function wea_c.min(list)
{
"type": "function",
"internal": false,
"description": "Finds the minimum value in the given list.",
"directives": [
{
"directive": "param",
"text": "list\tnumber[]\tThe list (table) of numbers to find the minimum value of.",
"name": "list",
"type": "number[]",
"description": "The list (table) of numbers to find the minimum value of."
},
{
"directive": "returns",
"text": "number\tThe minimum value in the given list.",
"type": "number",
"description": "The minimum value in the given list."
}
],
"line": 41,
"namespace": "worldeditadditions_core",
"line_last": 44,
"name": "min",
"instanced": false,
"args": [
"list"
],
"text": "--- Finds the minimum value in the given list.\n-- @param\tlist\tnumber[]\tThe list (table) of numbers to find the minimum value of.\n-- @returns\tnumber\tThe minimum value in the given list.\nfunction wea_c.min(list)",
"params": [
{
"directive": "param",
"text": "list\tnumber[]\tThe list (table) of numbers to find the minimum value of.",
"name": "list",
"type": "number[]",
"description": "The list (table) of numbers to find the minimum value of."
}
],
"returns": {
"directive": "returns",
"text": "number\tThe minimum value in the given list.",
"type": "number",
"description": "The minimum value in the given list."
},
"examples": [],
"name_full": "worldeditadditions_core.min",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L42-L45"
}
normalise_saplingname 🔗
Attempts to normalise a sapling name using the currently registered aliases.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
in_name | string | nil | The sapling name to normalise |
return_nil_on_failure | bool | nil | Whether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false). |
Returns
nil
Source
--- Attempts to normalise a sapling name using the currently registered aliases.
-- @param in_name string The sapling name to normalise
-- @param return_nil_on_failure bool Whether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false).
function wea_c.normalise_saplingname(in_name, return_nil_on_failure)
{
"type": "function",
"internal": false,
"description": "Attempts to normalise a sapling name using the currently registered aliases.",
"directives": [
{
"directive": "param",
"text": "in_name\t\t\t\t\tstring\tThe sapling name to normalise",
"name": "in_name",
"type": "string",
"description": "The sapling name to normalise"
},
{
"directive": "param",
"text": "return_nil_on_failure\tbool\tWhether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false).",
"name": "return_nil_on_failure",
"type": "bool",
"description": "Whether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false)."
}
],
"line": 115,
"namespace": "worldeditadditions_core",
"line_last": 118,
"name": "normalise_saplingname",
"instanced": false,
"args": [
"in_name",
"return_nil_on_failure"
],
"text": "--- Attempts to normalise a sapling name using the currently registered aliases.\n-- @param\tin_name\t\t\t\t\tstring\tThe sapling name to normalise\n-- @param\treturn_nil_on_failure\tbool\tWhether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false).\nfunction wea_c.normalise_saplingname(in_name, return_nil_on_failure)",
"params": [
{
"directive": "param",
"text": "in_name\t\t\t\t\tstring\tThe sapling name to normalise",
"name": "in_name",
"type": "string",
"description": "The sapling name to normalise"
},
{
"directive": "param",
"text": "return_nil_on_failure\tbool\tWhether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false).",
"name": "return_nil_on_failure",
"type": "bool",
"description": "Whether to return nil if we fail to resolve the sapling name with an alias, or return the original node name instead (default: false)."
}
],
"examples": [],
"name_full": "worldeditadditions_core.normalise_saplingname",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L116-L119"
}
player_axis2d 🔗
Returns the player's facing direction on the horizontal axes only.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to return facing direction of. |
Returns
string,int
:
Returns axis name and sign multiplier.
Source
--- Returns the player's facing direction on the horizontal axes only.
-- @deprecated Use wea_c.player_dir instead.
-- @param name string The name of the player to return facing direction of.
-- @return string,int Returns axis name and sign multiplier.
function wea_c.player_axis2d(name)
{
"type": "function",
"internal": false,
"description": "Returns the player's facing direction on the horizontal axes only.",
"directives": [
{
"directive": "deprecated",
"text": "Use wea_c.player_dir instead."
},
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
},
{
"directive": "returns",
"text": "string,int\tReturns axis name and sign multiplier.",
"type": "string,int",
"description": "Returns axis name and sign multiplier."
}
],
"line": 82,
"namespace": "worldeditadditions_core",
"line_last": 86,
"name": "player_axis2d",
"instanced": false,
"args": [
"name"
],
"text": "--- Returns the player's facing direction on the horizontal axes only.\n-- @deprecated\t\tUse wea_c.player_dir instead.\n-- @param\tname\tstring\tThe name of the player to return facing direction of.\n-- @return\tstring,int\tReturns axis name and sign multiplier.\nfunction wea_c.player_axis2d(name)",
"params": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
}
],
"returns": {
"directive": "returns",
"text": "string,int\tReturns axis name and sign multiplier.",
"type": "string,int",
"description": "Returns axis name and sign multiplier."
},
"examples": [],
"name_full": "worldeditadditions_core.player_axis2d",
"filename": "worldeditadditions_core/utils/player.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/player.lua#L83-L87"
}
player_dir 🔗
Returns the player's facing info including relative DIRs.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to return facing direction of. |
Returns
table(vector3+)
:
xyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down).
Source
--- Returns the player's facing info including relative DIRs.
-- @param name string The name of the player to return facing direction of.
-- @returns table(vector3+) xyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down).
function wea_c.player_dir(name)
{
"type": "function",
"internal": false,
"description": "Returns the player's facing info including relative DIRs.",
"directives": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
},
{
"directive": "returns",
"text": "table(vector3+)\txyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down).",
"type": "table(vector3+)",
"description": "xyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down)."
}
],
"line": 15,
"namespace": "worldeditadditions_core",
"line_last": 18,
"name": "player_dir",
"instanced": false,
"args": [
"name"
],
"text": "--- Returns the player's facing info including relative DIRs.\n-- @param\tname\tstring\tThe name of the player to return facing direction of.\n-- @returns\ttable(vector3+)\txyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down).\nfunction wea_c.player_dir(name)",
"params": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
}
],
"returns": {
"directive": "returns",
"text": "table(vector3+)\txyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down).",
"type": "table(vector3+)",
"description": "xyz raw values and {axis,sign} tables for facing direction and relative direction keys (front, back, left, right, up, down)."
},
"examples": [],
"name_full": "worldeditadditions_core.player_dir",
"filename": "worldeditadditions_core/utils/player.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/player.lua#L16-L19"
}
player_vector 🔗
Returns the player's position (at leg level).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
name | string | nil | The name of the player to return facing direction of. |
Returns
vector
:
Returns position.
Source
--- Returns the player's position (at leg level).
-- @param name string The name of the player to return facing direction of.
-- @return vector Returns position.
function wea_c.player_vector(name)
{
"type": "function",
"internal": false,
"description": "Returns the player's position (at leg level).",
"directives": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
},
{
"directive": "returns",
"text": "vector\tReturns position.",
"type": "vector",
"description": "Returns position."
}
],
"line": 8,
"namespace": "worldeditadditions_core",
"line_last": 11,
"name": "player_vector",
"instanced": false,
"args": [
"name"
],
"text": "--- Returns the player's position (at leg level).\n-- @param\tname\tstring\tThe name of the player to return facing direction of.\n-- @return\tvector\tReturns position.\nfunction wea_c.player_vector(name)",
"params": [
{
"directive": "param",
"text": "name\tstring\tThe name of the player to return facing direction of.",
"name": "name",
"type": "string",
"description": "The name of the player to return facing direction of."
}
],
"returns": {
"directive": "returns",
"text": "vector\tReturns position.",
"type": "vector",
"description": "Returns position."
},
"examples": [],
"name_full": "worldeditadditions_core.player_vector",
"filename": "worldeditadditions_core/utils/player.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/player.lua#L9-L12"
}
range 🔗
Return a sequence of numbers as a list.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
min | number | nil | The minimum value in the sequence. |
max | number | nil | The maximum value in the sequence. |
step | number | nil | The value to increment between each value in the sequence. |
Returns
number[]
:
The list of numbers.
Examples
Example 1
local result = worldeditadditions_core.range(0, 10, 1)
-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
Example 2
local result = worldeditadditions_core.range(6, 12, 2)
-- [ 6, 8, 10, 12 ]
Source
--- Return a sequence of numbers as a list.
-- @example
-- local result = worldeditadditions_core.range(0, 10, 1)
-- -- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
-- @example
-- local result = worldeditadditions_core.range(6, 12, 2)
-- -- [ 6, 8, 10, 12 ]
-- @param min number The minimum value in the sequence.
-- @param max number The maximum value in the sequence.
-- @param step number The value to increment between each value in the sequence.
-- @returns number[] The list of numbers.
function wea_c.range(min, max, step)
{
"type": "function",
"internal": false,
"description": "Return a sequence of numbers as a list.",
"directives": [
{
"directive": "example",
"text": "local result = worldeditadditions_core.range(0, 10, 1)\n-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]",
"description": "Example 1",
"example": "local result = worldeditadditions_core.range(0, 10, 1)\n-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">local</span><span style=\"color:#BD976A\"> result</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#BD976A\"> worldeditadditions_core</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">range</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#4C9A91\">0</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">10</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">1</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#758575DD\">-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></span></code></pre>"
},
{
"directive": "example",
"text": "local result = worldeditadditions_core.range(6, 12, 2)\n-- [ 6, 8, 10, 12 ]",
"description": "Example 2",
"example": "local result = worldeditadditions_core.range(6, 12, 2)\n-- [ 6, 8, 10, 12 ]",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">local</span><span style=\"color:#BD976A\"> result</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#BD976A\"> worldeditadditions_core</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">range</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#4C9A91\">6</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">12</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">2</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#758575DD\">-- [ 6, 8, 10, 12 ]</span></span></code></pre>"
},
{
"directive": "param",
"text": "min\t\tnumber\t\tThe minimum value in the sequence.",
"name": "min",
"type": "number",
"description": "The minimum value in the sequence."
},
{
"directive": "param",
"text": "max\t\tnumber\t\tThe maximum value in the sequence.",
"name": "max",
"type": "number",
"description": "The maximum value in the sequence."
},
{
"directive": "param",
"text": "step\tnumber\t\tThe value to increment between each value in the sequence.",
"name": "step",
"type": "number",
"description": "The value to increment between each value in the sequence."
},
{
"directive": "returns",
"text": "number[]\tThe list of numbers.",
"type": "number[]",
"description": "The list of numbers."
}
],
"line": 118,
"namespace": "worldeditadditions_core",
"line_last": 129,
"name": "range",
"instanced": false,
"args": [
"min",
"max",
"step"
],
"text": "--- Return a sequence of numbers as a list.\n-- @example\n-- local result = worldeditadditions_core.range(0, 10, 1)\n-- -- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]\n-- @example\n-- local result = worldeditadditions_core.range(6, 12, 2)\n-- -- [ 6, 8, 10, 12 ]\n-- @param\tmin\t\tnumber\t\tThe minimum value in the sequence.\n-- @param\tmax\t\tnumber\t\tThe maximum value in the sequence.\n-- @param\tstep\tnumber\t\tThe value to increment between each value in the sequence.\n-- @returns\tnumber[]\tThe list of numbers.\nfunction wea_c.range(min, max, step)",
"params": [
{
"directive": "param",
"text": "min\t\tnumber\t\tThe minimum value in the sequence.",
"name": "min",
"type": "number",
"description": "The minimum value in the sequence."
},
{
"directive": "param",
"text": "max\t\tnumber\t\tThe maximum value in the sequence.",
"name": "max",
"type": "number",
"description": "The maximum value in the sequence."
},
{
"directive": "param",
"text": "step\tnumber\t\tThe value to increment between each value in the sequence.",
"name": "step",
"type": "number",
"description": "The value to increment between each value in the sequence."
}
],
"returns": {
"directive": "returns",
"text": "number[]\tThe list of numbers.",
"type": "number[]",
"description": "The list of numbers."
},
"examples": [
{
"directive": "example",
"text": "local result = worldeditadditions_core.range(0, 10, 1)\n-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]",
"description": "Example 1",
"example": "local result = worldeditadditions_core.range(0, 10, 1)\n-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">local</span><span style=\"color:#BD976A\"> result</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#BD976A\"> worldeditadditions_core</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">range</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#4C9A91\">0</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">10</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">1</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#758575DD\">-- [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></span></code></pre>"
},
{
"directive": "example",
"text": "local result = worldeditadditions_core.range(6, 12, 2)\n-- [ 6, 8, 10, 12 ]",
"description": "Example 2",
"example": "local result = worldeditadditions_core.range(6, 12, 2)\n-- [ 6, 8, 10, 12 ]",
"example_highlighted": "<pre class=\"shiki vitesse-dark\" style=\"background-color:#121212;color:#dbd7caee\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color:#4D9375\">local</span><span style=\"color:#BD976A\"> result</span><span style=\"color:#CB7676\"> =</span><span style=\"color:#BD976A\"> worldeditadditions_core</span><span style=\"color:#DBD7CAEE\">.</span><span style=\"color:#B8A965\">range</span><span style=\"color:#DBD7CAEE\">(</span><span style=\"color:#4C9A91\">6</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">12</span><span style=\"color:#DBD7CAEE\">, </span><span style=\"color:#4C9A91\">2</span><span style=\"color:#DBD7CAEE\">)</span></span>\n<span class=\"line\"><span style=\"color:#758575DD\">-- [ 6, 8, 10, 12 ]</span></span></code></pre>"
}
],
"name_full": "worldeditadditions_core.range",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L119-L130"
}
raycast 🔗
Raycasts to find a node in the direction the given player is looking.
This function is not currently aware of custom hitboxes.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player | Player | nil | The player object to raycast from. |
maxdist | number | nil | The maximum distance to raycast. |
skip_liquid | bool | nil | Whether to skip liquids when raycasting. |
Returns
position, number
:
nil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found.
Source
--- Raycasts to find a node in the direction the given player is looking.
--
-- This function is not currently aware of custom hitboxes.
-- @param player Player The player object to raycast from.
-- @param maxdist number The maximum distance to raycast.
-- @param skip_liquid bool Whether to skip liquids when raycasting.
-- @return position, number nil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found.
function wea_c.raycast(player, maxdist, skip_liquid)
{
"type": "function",
"internal": false,
"description": "Raycasts to find a node in the direction the given player is looking.\n\nThis function is not currently aware of custom hitboxes.",
"directives": [
{
"directive": "param",
"text": "player\t\t\tPlayer\tThe player object to raycast from.",
"name": "player",
"type": "Player",
"description": "The player object to raycast from."
},
{
"directive": "param",
"text": "maxdist\t\t\tnumber\tThe maximum distance to raycast.",
"name": "maxdist",
"type": "number",
"description": "The maximum distance to raycast."
},
{
"directive": "param",
"text": "skip_liquid\t\tbool\tWhether to skip liquids when raycasting.",
"name": "skip_liquid",
"type": "bool",
"description": "Whether to skip liquids when raycasting."
},
{
"directive": "returns",
"text": "position, number\t\tnil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found.",
"type": "position, number",
"description": "nil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found."
}
],
"line": 6,
"namespace": "worldeditadditions_core",
"line_last": 13,
"name": "raycast",
"instanced": false,
"args": [
"player",
"maxdist",
"skip_liquid"
],
"text": "--- Raycasts to find a node in the direction the given player is looking.\n-- \n-- This function is not currently aware of custom hitboxes.\n-- @param\tplayer\t\t\tPlayer\tThe player object to raycast from.\n-- @param\tmaxdist\t\t\tnumber\tThe maximum distance to raycast.\n-- @param\tskip_liquid\t\tbool\tWhether to skip liquids when raycasting.\n-- @return\tposition, number\t\tnil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found.\nfunction wea_c.raycast(player, maxdist, skip_liquid)",
"params": [
{
"directive": "param",
"text": "player\t\t\tPlayer\tThe player object to raycast from.",
"name": "player",
"type": "Player",
"description": "The player object to raycast from."
},
{
"directive": "param",
"text": "maxdist\t\t\tnumber\tThe maximum distance to raycast.",
"name": "maxdist",
"type": "number",
"description": "The maximum distance to raycast."
},
{
"directive": "param",
"text": "skip_liquid\t\tbool\tWhether to skip liquids when raycasting.",
"name": "skip_liquid",
"type": "bool",
"description": "Whether to skip liquids when raycasting."
}
],
"returns": {
"directive": "returns",
"text": "position, number\t\tnil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found.",
"type": "position, number",
"description": "nil if nothing was found (or unloaded chunks were hit), or the position as an {x, y, z} table and the node id if something was found."
},
"examples": [],
"name_full": "worldeditadditions_core.raycast",
"filename": "worldeditadditions_core/utils/raycast_adv.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/raycast_adv.lua#L7-L14"
}
register_alias 🔗
Register an alias of an existing worldeditadditions/worldedit command.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
cmdname_target | string | nil | The target name for the alias |
cmdname_source | string | nil | The source name of the command to alias the target to. |
override | bool | false | Whether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists. |
Returns
bool
:
Whether the override operation was successful or not.
Source
--- Register an alias of an existing worldeditadditions/worldedit command.
-- @param cmdname_target string The target name for the alias
-- @param cmdname_source string The source name of the command to alias the target to.
-- @param override=false bool Whether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists.
-- @returns bool Whether the override operation was successful or not.
local function register_alias(cmdname_target, cmdname_source, override)
{
"type": "function",
"internal": false,
"description": "Register an alias of an existing worldeditadditions/worldedit command.",
"directives": [
{
"directive": "param",
"text": "cmdname_target\tstring\tThe target name for the alias",
"name": "cmdname_target",
"type": "string",
"description": "The target name for the alias"
},
{
"directive": "param",
"text": "cmdname_source\tstring\tThe source name of the command to alias the target to.",
"name": "cmdname_source",
"type": "string",
"description": "The source name of the command to alias the target to."
},
{
"directive": "param",
"text": "override=false\tbool\tWhether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists.",
"name": "override",
"type": "bool",
"description": "Whether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists.",
"default_value": "false"
},
{
"directive": "returns",
"text": "bool\t\t\tWhether the override operation was successful or not.",
"type": "bool",
"description": "Whether the override operation was successful or not."
}
],
"line": 6,
"namespace": "worldeditadditions_core",
"line_last": 11,
"name": "register_alias",
"instanced": false,
"args": [
"cmdname_target",
"cmdname_source",
"override"
],
"text": "--- Register an alias of an existing worldeditadditions/worldedit command.\n-- @param\tcmdname_target\tstring\tThe target name for the alias\n-- @param\tcmdname_source\tstring\tThe source name of the command to alias the target to.\n-- @param\toverride=false\tbool\tWhether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists.\n-- @returns\tbool\t\t\tWhether the override operation was successful or not.\nlocal function register_alias(cmdname_target, cmdname_source, override)",
"params": [
{
"directive": "param",
"text": "cmdname_target\tstring\tThe target name for the alias",
"name": "cmdname_target",
"type": "string",
"description": "The target name for the alias"
},
{
"directive": "param",
"text": "cmdname_source\tstring\tThe source name of the command to alias the target to.",
"name": "cmdname_source",
"type": "string",
"description": "The source name of the command to alias the target to."
},
{
"directive": "param",
"text": "override=false\tbool\tWhether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists.",
"name": "override",
"type": "bool",
"description": "Whether to override the target command name if it exists. Defaults to false, which results in an error being thrown if the target command name already exists.",
"default_value": "false"
}
],
"returns": {
"directive": "returns",
"text": "bool\t\t\tWhether the override operation was successful or not.",
"type": "bool",
"description": "Whether the override operation was successful or not."
},
"examples": [],
"name_full": "worldeditadditions_core.register_alias",
"filename": "worldeditadditions_core/core/register_alias.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/register_alias.lua#L7-L12"
}
register_sapling_alias 🔗
Register a new sapling alias.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
sapling_node_name | string | nil | The canonical name of the sapling. |
alias | string | nil | 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.
Source
--- 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 wea_c.register_sapling_alias(sapling_node_name, alias)
{
"type": "function",
"internal": false,
"description": "Register a new sapling alias.",
"directives": [
{
"directive": "param",
"text": "sapling_node_name\tstring\t\tThe canonical name of the sapling.",
"name": "sapling_node_name",
"type": "string",
"description": "The canonical name of the sapling."
},
{
"directive": "param",
"text": "alias\t\t\t\tstring\t\tThe alias name of the sapling.",
"name": "alias",
"type": "string",
"description": "The alias name of the sapling."
},
{
"directive": "returns",
"text": "bool[,string]\t\tWhether the alias registration was successful or not. If false, then an error message as a string is also returned as the second value.",
"type": "bool[,string]",
"description": "Whether the alias registration was successful or not. If false, then an error message as a string is also returned as the second value."
}
],
"line": 84,
"namespace": "worldeditadditions_core",
"line_last": 88,
"name": "register_sapling_alias",
"instanced": false,
"args": [
"sapling_node_name",
"alias"
],
"text": "--- Register a new sapling alias.\n-- @param\tsapling_node_name\tstring\t\tThe canonical name of the sapling.\n-- @param\talias\t\t\t\tstring\t\tThe alias name of the sapling.\n-- @returns\tbool[,string]\t\tWhether the alias registration was successful or not. If false, then an error message as a string is also returned as the second value.\nfunction wea_c.register_sapling_alias(sapling_node_name, alias)",
"params": [
{
"directive": "param",
"text": "sapling_node_name\tstring\t\tThe canonical name of the sapling.",
"name": "sapling_node_name",
"type": "string",
"description": "The canonical name of the sapling."
},
{
"directive": "param",
"text": "alias\t\t\t\tstring\t\tThe alias name of the sapling.",
"name": "alias",
"type": "string",
"description": "The alias name of the sapling."
}
],
"returns": {
"directive": "returns",
"text": "bool[,string]\t\tWhether the alias registration was successful or not. If false, then an error message as a string is also returned as the second value.",
"type": "bool[,string]",
"description": "Whether the alias registration was successful or not. If false, then an error message as a string is also returned as the second value."
},
"examples": [],
"name_full": "worldeditadditions_core.register_sapling_alias",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L85-L89"
}
register_sapling_alias_many 🔗
Convenience function to register many sapling aliases at once.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
tbl | [string, string][] | nil | 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.
Source
--- 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 wea_c.register_sapling_alias_many(tbl)
{
"type": "function",
"internal": false,
"description": "Convenience function to register many sapling aliases at once.",
"directives": [
{
"directive": "param",
"text": "tbl\t[string, string][]\tA list of tables containing exactly 2 strings in the form { sapling_node_name, alias }.",
"name": "tbl",
"type": "[string, string][]",
"description": "A list of tables containing exactly 2 strings in the form { sapling_node_name, alias }."
},
{
"directive": "returns",
"text": "bool[,string]\t\tWhether the alias registrations were successful or not. If false, then an error message as a string is also returned as the second value.",
"type": "bool[,string]",
"description": "Whether the alias registrations were successful or not. If false, then an error message as a string is also returned as the second value."
}
],
"line": 95,
"namespace": "worldeditadditions_core",
"line_last": 98,
"name": "register_sapling_alias_many",
"instanced": false,
"args": [
"tbl"
],
"text": "--- Convenience function to register many sapling aliases at once.\n-- @param\ttbl\t[string, string][]\tA list of tables containing exactly 2 strings in the form { sapling_node_name, alias }.\n-- @returns\tbool[,string]\t\tWhether the alias registrations were successful or not. If false, then an error message as a string is also returned as the second value.\nfunction wea_c.register_sapling_alias_many(tbl)",
"params": [
{
"directive": "param",
"text": "tbl\t[string, string][]\tA list of tables containing exactly 2 strings in the form { sapling_node_name, alias }.",
"name": "tbl",
"type": "[string, string][]",
"description": "A list of tables containing exactly 2 strings in the form { sapling_node_name, alias }."
}
],
"returns": {
"directive": "returns",
"text": "bool[,string]\t\tWhether the alias registrations were successful or not. If false, then an error message as a string is also returned as the second value.",
"type": "bool[,string]",
"description": "Whether the alias registrations were successful or not. If false, then an error message as a string is also returned as the second value."
},
"examples": [],
"name_full": "worldeditadditions_core.register_sapling_alias_many",
"filename": "worldeditadditions_core/utils/node_identification.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/node_identification.lua#L96-L99"
}
round 🔗
Rounds a number to a given number of decimal places.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
num | number | nil | The number to round. |
numDecimalPlaces | number | nil | The number of decimal places to round to. Should be an integer greater than or equal to 0. |
Returns
nil
Source
--- Rounds a number to a given number of decimal places.
-- @source http://lua-users.org/wiki/SimpleRound
-- @param num number The number to round.
-- @param numDecimalPlaces number The number of decimal places to round to. Should be an integer greater than or equal to 0.
function wea_c.round(num, numDecimalPlaces)
{
"type": "function",
"internal": false,
"description": "Rounds a number to a given number of decimal places.",
"directives": [
{
"directive": "source",
"text": "http://lua-users.org/wiki/SimpleRound"
},
{
"directive": "param",
"text": "num\t\t\t\t\tnumber\tThe number to round.",
"name": "num",
"type": "number",
"description": "The number to round."
},
{
"directive": "param",
"text": "numDecimalPlaces \tnumber\tThe number of decimal places to round to. Should be an integer greater than or equal to 0.",
"name": "numDecimalPlaces ",
"type": "number",
"description": "The number of decimal places to round to. Should be an integer greater than or equal to 0."
}
],
"line": 4,
"namespace": "worldeditadditions_core",
"line_last": 8,
"name": "round",
"instanced": false,
"args": [
"num",
"numDecimalPlaces"
],
"text": "--- Rounds a number to a given number of decimal places.\n-- @source http://lua-users.org/wiki/SimpleRound\n-- @param\tnum\t\t\t\t\tnumber\tThe number to round.\n-- @param\tnumDecimalPlaces \tnumber\tThe number of decimal places to round to. Should be an integer greater than or equal to 0.\nfunction wea_c.round(num, numDecimalPlaces)",
"params": [
{
"directive": "param",
"text": "num\t\t\t\t\tnumber\tThe number to round.",
"name": "num",
"type": "number",
"description": "The number to round."
},
{
"directive": "param",
"text": "numDecimalPlaces \tnumber\tThe number of decimal places to round to. Should be an integer greater than or equal to 0.",
"name": "numDecimalPlaces ",
"type": "number",
"description": "The number of decimal places to round to. Should be an integer greater than or equal to 0."
}
],
"examples": [],
"name_full": "worldeditadditions_core.round",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L5-L9"
}
run_command 🔗
Runs a command with the given name and options for the given player. Emits several events in the process, in the following order:
pre-parse
: Beforeparamtext
parsing but after validation.post-parse
: Directly afterparamtext
parsingpost-nodesneeded
: If anodesneeded
function is provided, this executes after the nodesneeded function is called.pre-execute
: Directly before the command is invoked.post-execute
: After the command is executed.
Items #4 and #5 here are actually emitted by the private internal function run_command_stage2
.
The event object passed has the following properties:
cmddef
(table): The WEA-registered definition of the commandcmdname
(string): The name of the command, sans-forward slashesparamtext
(string): The unparsedparamtext
the user passed as argument(s) to the command.player_name
(string): The name of the player calling the command.paramargs
(table): The parsed arguments returned by the parsing function. Available inpost-parse
and later.potential_changes
(number): The number of potential nodes that could be changed as a result of running the command.post-nodesneeded
and later: remember not all commands have an associatednodesneeded
function.success
(boolean): Whether the command executed successfully or not. Available only inpost-execute
.result
(any): Theresult
value returned by the command function. Value depends on the command executed. Available only inpost-execute
. SHOULD be a string but don't count on it.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
cmdname | string | nil | The name of the command to run. |
options | table | nil | The table of options associated with the command. See worldeditadditions_core.register_command for more information. |
player_name | string | nil | The name of the player to execute the command for. |
paramtext | string | nil | The unparsed argument string to pass to the command when executing it. |
Returns
nil
Source
--- Runs a command with the given name and options for the given player.
-- Emits several events in the process, in the following order:
-- 1. **`pre-parse`:** Before `paramtext` parsing but after validation.
-- 2. **`post-parse`:** Directly after `paramtext` parsing
-- 3. **`post-nodesneeded`:** If a `nodesneeded` function is provided, this executes after the nodesneeded function is called.
-- 4. **`pre-execute`:** Directly before the command is invoked.
-- 5. **`post-execute`:** After the command is executed.
--
-- Items #4 and #5 here are actually emitted by the private internal function `run_command_stage2`.
--
-- The event object passed has the following properties:
-- - `cmddef` (table): The WEA-registered definition of the command
-- - `cmdname` (string): The name of the command, sans-forward slashes
-- - `paramtext` (string): The unparsed `paramtext` the user passed as argument(s) to the command.
-- - `player_name` (string): The name of the player calling the command.
-- - `paramargs` (table): The parsed arguments returned by the parsing function. Available in `post-parse` and later.
-- - `potential_changes` (number): The number of potential nodes that could be changed as a result of running the command. `post-nodesneeded` and later: remember not all commands have an associated `nodesneeded` function.
-- - `success` (boolean): Whether the command executed successfully or not. Available only in `post-execute`.
-- - `result` (any): The `result` value returned by the command function. Value depends on the command executed. Available only in `post-execute`. SHOULD be a string but don't count on it.
--
-- @param cmdname string The name of the command to run.
-- @param options table The table of options associated with the command. See worldeditadditions_core.register_command for more information.
-- @param player_name string The name of the player to execute the command for.
-- @param paramtext string The unparsed argument string to pass to the command when executing it.
local function run_command(cmdname, options, player_name, paramtext)
{
"type": "function",
"internal": false,
"description": "Runs a command with the given name and options for the given player.\nEmits several events in the process, in the following order:\n1. **`pre-parse`:** Before `paramtext` parsing but after validation.\n2. **`post-parse`:** Directly after `paramtext` parsing\n3. **`post-nodesneeded`:** If a `nodesneeded` function is provided, this executes after the nodesneeded function is called.\n4. **`pre-execute`:** Directly before the command is invoked.\n5. **`post-execute`:** After the command is executed.\n\nItems #4 and #5 here are actually emitted by the private internal function `run_command_stage2`.\n\nThe event object passed has the following properties:\n- `cmddef` (table): The WEA-registered definition of the command\n- `cmdname` (string): The name of the command, sans-forward slashes\n- `paramtext` (string): The unparsed `paramtext` the user passed as argument(s) to the command.\n- `player_name` (string): The name of the player calling the command.\n- `paramargs` (table): The parsed arguments returned by the parsing function. Available in `post-parse` and later.\n- `potential_changes` (number): The number of potential nodes that could be changed as a result of running the command. `post-nodesneeded` and later: remember not all commands have an associated `nodesneeded` function.\n- `success` (boolean): Whether the command executed successfully or not. Available only in `post-execute`.\n- `result` (any): The `result` value returned by the command function. Value depends on the command executed. Available only in `post-execute`. SHOULD be a string but don't count on it.\n",
"directives": [
{
"directive": "param",
"text": "cmdname\t\tstring\tThe name of the command to run.",
"name": "cmdname",
"type": "string",
"description": "The name of the command to run."
},
{
"directive": "param",
"text": "options\t\ttable\tThe table of options associated with the command. See worldeditadditions_core.register_command for more information.",
"name": "options",
"type": "table",
"description": "The table of options associated with the command. See worldeditadditions_core.register_command for more information."
},
{
"directive": "param",
"text": "player_name\tstring\tThe name of the player to execute the command for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to execute the command for."
},
{
"directive": "param",
"text": "paramtext\tstring\tThe unparsed argument string to pass to the command when executing it.",
"name": "paramtext",
"type": "string",
"description": "The unparsed argument string to pass to the command when executing it."
}
],
"line": 122,
"namespace": "worldeditadditions_core",
"line_last": 146,
"name": "run_command",
"instanced": false,
"args": [
"cmdname",
"options",
"player_name",
"paramtext"
],
"text": "--- Runs a command with the given name and options for the given player.\n-- Emits several events in the process, in the following order:\n-- 1. **`pre-parse`:** Before `paramtext` parsing but after validation.\n-- 2. **`post-parse`:** Directly after `paramtext` parsing\n-- 3. **`post-nodesneeded`:** If a `nodesneeded` function is provided, this executes after the nodesneeded function is called.\n-- 4. **`pre-execute`:** Directly before the command is invoked.\n-- 5. **`post-execute`:** After the command is executed.\n-- \n-- Items #4 and #5 here are actually emitted by the private internal function `run_command_stage2`.\n-- \n-- The event object passed has the following properties:\n-- - `cmddef` (table): The WEA-registered definition of the command\n-- - `cmdname` (string): The name of the command, sans-forward slashes\n-- - `paramtext` (string): The unparsed `paramtext` the user passed as argument(s) to the command.\n-- - `player_name` (string): The name of the player calling the command.\n-- - `paramargs` (table): The parsed arguments returned by the parsing function. Available in `post-parse` and later.\n-- - `potential_changes` (number): The number of potential nodes that could be changed as a result of running the command. `post-nodesneeded` and later: remember not all commands have an associated `nodesneeded` function.\n-- - `success` (boolean): Whether the command executed successfully or not. Available only in `post-execute`.\n-- - `result` (any): The `result` value returned by the command function. Value depends on the command executed. Available only in `post-execute`. SHOULD be a string but don't count on it.\n-- \n-- @param\tcmdname\t\tstring\tThe name of the command to run.\n-- @param\toptions\t\ttable\tThe table of options associated with the command. See worldeditadditions_core.register_command for more information.\n-- @param\tplayer_name\tstring\tThe name of the player to execute the command for.\n-- @param\tparamtext\tstring\tThe unparsed argument string to pass to the command when executing it.\nlocal function run_command(cmdname, options, player_name, paramtext)",
"params": [
{
"directive": "param",
"text": "cmdname\t\tstring\tThe name of the command to run.",
"name": "cmdname",
"type": "string",
"description": "The name of the command to run."
},
{
"directive": "param",
"text": "options\t\ttable\tThe table of options associated with the command. See worldeditadditions_core.register_command for more information.",
"name": "options",
"type": "table",
"description": "The table of options associated with the command. See worldeditadditions_core.register_command for more information."
},
{
"directive": "param",
"text": "player_name\tstring\tThe name of the player to execute the command for.",
"name": "player_name",
"type": "string",
"description": "The name of the player to execute the command for."
},
{
"directive": "param",
"text": "paramtext\tstring\tThe unparsed argument string to pass to the command when executing it.",
"name": "paramtext",
"type": "string",
"description": "The unparsed argument string to pass to the command when executing it."
}
],
"examples": [],
"name_full": "worldeditadditions_core.run_command",
"filename": "worldeditadditions_core/core/run_command.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/run_command.lua#L123-L147"
}
run_command_stage2 🔗
Actually runs the command in question. [HIDDEN] Unfortunately needed to keep the codebase clena because Lua sucks.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player executing the function. |
func | function | nil | The function to execute. |
parse_result | table | nil | The output of the parsing function that was presumably called earlier. Will be unpacked and passed to |
tbl_event | table | nil | Internal event table used when calling |
Returns
nil
Source
--- Actually runs the command in question. [HIDDEN]
-- Unfortunately needed to keep the codebase clena because Lua sucks.
-- @internal
-- @param player_name string The name of the player executing the function.
-- @param func function The function to execute.
-- @param parse_result table The output of the parsing function that was presumably called earlier. Will be unpacked and passed to `func` as arguments.
-- @param tbl_event table Internal event table used when calling `worldeditadditions_core.emit(event_name, tbl_event)`.
-- @returns nil
local function run_command_stage2(player_name, func, parse_result, tbl_event)
{
"type": "function",
"internal": true,
"description": "Actually runs the command in question. [HIDDEN]\nUnfortunately needed to keep the codebase clena because Lua sucks.",
"directives": [
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "player_name\tstring\t\tThe name of the player executing the function.",
"name": "player_name",
"type": "string",
"description": "The name of the player executing the function."
},
{
"directive": "param",
"text": "func\t\tfunction\tThe function to execute.",
"name": "func",
"type": "function",
"description": "The function to execute."
},
{
"directive": "param",
"text": "parse_result\ttable\tThe output of the parsing function that was presumably called earlier. Will be unpacked and passed to `func` as arguments.",
"name": "parse_result",
"type": "table",
"description": "The output of the parsing function that was presumably called earlier. Will be unpacked and passed to `func` as arguments."
},
{
"directive": "param",
"text": "tbl_event\ttable\t\tInternal event table used when calling `worldeditadditions_core.emit(event_name, tbl_event)`.",
"name": "tbl_event",
"type": "table",
"description": "Internal event table used when calling `worldeditadditions_core.emit(event_name, tbl_event)`."
},
{
"directive": "returns",
"text": "nil",
"type": "nil"
}
],
"line": 29,
"namespace": "worldeditadditions_core",
"line_last": 37,
"name": "run_command_stage2",
"instanced": false,
"args": [
"player_name",
"func",
"parse_result",
"tbl_event"
],
"text": "--- Actually runs the command in question. [HIDDEN]\n-- Unfortunately needed to keep the codebase clena because Lua sucks.\n-- @internal\n-- @param\tplayer_name\tstring\t\tThe name of the player executing the function. \n-- @param\tfunc\t\tfunction\tThe function to execute.\n-- @param\tparse_result\ttable\tThe output of the parsing function that was presumably called earlier. Will be unpacked and passed to `func` as arguments.\n-- @param\ttbl_event\ttable\t\tInternal event table used when calling `worldeditadditions_core.emit(event_name, tbl_event)`.\n-- @returns\tnil\nlocal function run_command_stage2(player_name, func, parse_result, tbl_event)",
"params": [
{
"directive": "param",
"text": "player_name\tstring\t\tThe name of the player executing the function.",
"name": "player_name",
"type": "string",
"description": "The name of the player executing the function."
},
{
"directive": "param",
"text": "func\t\tfunction\tThe function to execute.",
"name": "func",
"type": "function",
"description": "The function to execute."
},
{
"directive": "param",
"text": "parse_result\ttable\tThe output of the parsing function that was presumably called earlier. Will be unpacked and passed to `func` as arguments.",
"name": "parse_result",
"type": "table",
"description": "The output of the parsing function that was presumably called earlier. Will be unpacked and passed to `func` as arguments."
},
{
"directive": "param",
"text": "tbl_event\ttable\t\tInternal event table used when calling `worldeditadditions_core.emit(event_name, tbl_event)`.",
"name": "tbl_event",
"type": "table",
"description": "Internal event table used when calling `worldeditadditions_core.emit(event_name, tbl_event)`."
}
],
"returns": {
"directive": "returns",
"text": "nil",
"type": "nil"
},
"examples": [],
"name_full": "worldeditadditions_core.run_command_stage2",
"filename": "worldeditadditions_core/core/run_command.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/run_command.lua#L30-L38"
}
safe_function 🔗
Calls the given function fn
with the UNPACKED arguments from args
, catching errors and sending the calling player a nice error message with a report link.
WARNING: Do NOT nest safe_function()
calls!!!
You do not need to call this function normally. For commands registered via worldeditadditions_core.register_command
, your parse()
, nodes_needed()
, and func()
functions are all protected with this function automatically.
You may need to call this function in an async function - NOT in the main func()
, but inside every minetest.after()
call. This is because an async jump like that provided by minetest.after()
will cause the original function to end, thus ending the safe_function()
sandbox.
TODO implement wea_core.safe_after()
.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
fn | function | nil | The function to call |
args | table | nil | The table of args to unpack and send to |
player_name | string|nil | nil | The name of the player affected. If nil then no message is sent to the player. |
error_msg | string | nil | The error message to send when |
cmdname | string|nil | nil | Optional. The name of the command being run. |
Returns
bool,any,...
:
A success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace.
Source
--- Calls the given function `fn` with the UNPACKED arguments from `args`, catching errors and sending the calling player a nice error message with a report link.
--
-- WARNING: Do NOT nest `safe_function()` calls!!!
--
-- You do not need to call this function normally. For commands registered via `worldeditadditions_core.register_command`, your `parse()`, `nodes_needed()`, and `func()` functions are all protected with this function automatically.
--
-- You may need to call this function in an async function - NOT in the main `func()`, but inside every `minetest.after()` call. This is because an async jump like that provided by `minetest.after()` will cause the original function to end, thus ending the `safe_function()` sandbox.
--
-- TODO implement `wea_core.safe_after()`.
-- @param fn function The function to call
-- @param args table The table of args to unpack and send to `fn` as arguments
-- @param player_name string|nil The name of the player affected. If nil then no message is sent to the player.
-- @param error_msg string The error message to send when `fn` inevitably crashes.
-- @param cmdname string|nil Optional. The name of the command being run.
-- @returns bool,any,... A success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace.
local function safe_function(fn, args, player_name, error_msg, cmdname)
{
"type": "function",
"internal": false,
"description": "Calls the given function `fn` with the UNPACKED arguments from `args`, catching errors and sending the calling player a nice error message with a report link.\n\nWARNING: Do NOT nest `safe_function()` calls!!!\n\nYou do not need to call this function normally. For commands registered via `worldeditadditions_core.register_command`, your `parse()`, `nodes_needed()`, and `func()` functions are all protected with this function automatically.\n\nYou may need to call this function in an async function - NOT in the main `func()`, but inside every `minetest.after()` call. This is because an async jump like that provided by `minetest.after()` will cause the original function to end, thus ending the `safe_function()` sandbox.\n\nTODO implement `wea_core.safe_after()`.",
"directives": [
{
"directive": "param",
"text": "fn\t\t\tfunction\t\tThe function to call",
"name": "fn",
"type": "function",
"description": "The function to call"
},
{
"directive": "param",
"text": "args\t\ttable\t\t\tThe table of args to unpack and send to `fn` as arguments",
"name": "args",
"type": "table",
"description": "The table of args to unpack and send to `fn` as arguments"
},
{
"directive": "param",
"text": "player_name\tstring|nil\t\tThe name of the player affected. If nil then no message is sent to the player.",
"name": "player_name",
"type": "string|nil",
"description": "The name of the player affected. If nil then no message is sent to the player."
},
{
"directive": "param",
"text": "error_msg\tstring\t\t\tThe error message to send when `fn` inevitably crashes.",
"name": "error_msg",
"type": "string",
"description": "The error message to send when `fn` inevitably crashes."
},
{
"directive": "param",
"text": "cmdname\t\tstring|nil\t\tOptional. The name of the command being run.",
"name": "cmdname",
"type": "string|nil",
"description": "Optional. The name of the command being run."
},
{
"directive": "returns",
"text": "bool,any,...\tA success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace.",
"type": "bool,any,...",
"description": "A success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace."
}
],
"line": 63,
"namespace": "worldeditadditions_core",
"line_last": 78,
"name": "safe_function",
"instanced": false,
"args": [
"fn",
"args",
"player_name",
"error_msg",
"cmdname"
],
"text": "--- Calls the given function `fn` with the UNPACKED arguments from `args`, catching errors and sending the calling player a nice error message with a report link.\n-- \n-- WARNING: Do NOT nest `safe_function()` calls!!!\n-- \n-- You do not need to call this function normally. For commands registered via `worldeditadditions_core.register_command`, your `parse()`, `nodes_needed()`, and `func()` functions are all protected with this function automatically.\n-- \n-- You may need to call this function in an async function - NOT in the main `func()`, but inside every `minetest.after()` call. This is because an async jump like that provided by `minetest.after()` will cause the original function to end, thus ending the `safe_function()` sandbox.\n-- \n-- TODO implement `wea_core.safe_after()`.\n-- @param\tfn\t\t\tfunction\t\tThe function to call\n-- @param\targs\t\ttable\t\t\tThe table of args to unpack and send to `fn` as arguments\n-- @param\tplayer_name\tstring|nil\t\tThe name of the player affected. If nil then no message is sent to the player.\n-- @param\terror_msg\tstring\t\t\tThe error message to send when `fn` inevitably crashes.\n-- @param\tcmdname\t\tstring|nil\t\tOptional. The name of the command being run.\n-- @returns\tbool,any,...\tA success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace.\nlocal function safe_function(fn, args, player_name, error_msg, cmdname)",
"params": [
{
"directive": "param",
"text": "fn\t\t\tfunction\t\tThe function to call",
"name": "fn",
"type": "function",
"description": "The function to call"
},
{
"directive": "param",
"text": "args\t\ttable\t\t\tThe table of args to unpack and send to `fn` as arguments",
"name": "args",
"type": "table",
"description": "The table of args to unpack and send to `fn` as arguments"
},
{
"directive": "param",
"text": "player_name\tstring|nil\t\tThe name of the player affected. If nil then no message is sent to the player.",
"name": "player_name",
"type": "string|nil",
"description": "The name of the player affected. If nil then no message is sent to the player."
},
{
"directive": "param",
"text": "error_msg\tstring\t\t\tThe error message to send when `fn` inevitably crashes.",
"name": "error_msg",
"type": "string",
"description": "The error message to send when `fn` inevitably crashes."
},
{
"directive": "param",
"text": "cmdname\t\tstring|nil\t\tOptional. The name of the command being run.",
"name": "cmdname",
"type": "string|nil",
"description": "Optional. The name of the command being run."
}
],
"returns": {
"directive": "returns",
"text": "bool,any,...\tA success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace.",
"type": "bool,any,...",
"description": "A success bool (true == success), and then if success == true the rest of the arguments are the (unpacked) return values from the function called. If success == false, then the 2nd argument will be the stack trace."
},
"examples": [],
"name_full": "worldeditadditions_core.safe_function",
"filename": "worldeditadditions_core/core/safe_function.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/safe_function.lua#L64-L79"
}
safe_region 🔗
Captures the given function in the safe_region subsystem for later execution. CAUTION: This command is not available for general use.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
player_name | string | nil | The name of the player. |
cmdname | string | nil | The name of the command being executed. |
func | function | nil | The function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed). |
Returns
nil
Source
--- Captures the given function in the safe_region subsystem for later execution.
-- CAUTION: This command is not available for general use.
-- @internal
-- @param player_name string The name of the player.
-- @param cmdname string The name of the command being executed.
-- @param func function The function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed).
-- @returns nil
local function safe_region(player_name, cmdname, func)
{
"type": "function",
"internal": true,
"description": "Captures the given function in the safe_region subsystem for later execution.\nCAUTION: This command is not available for general use.",
"directives": [
{
"directive": "internal",
"text": ""
},
{
"directive": "param",
"text": "player_name\t\tstring\t\tThe name of the player.",
"name": "player_name",
"type": "string",
"description": "The name of the player."
},
{
"directive": "param",
"text": "cmdname\t\t\tstring\t\tThe name of the command being executed.",
"name": "cmdname",
"type": "string",
"description": "The name of the command being executed."
},
{
"directive": "param",
"text": "func\t\t\tfunction\tThe function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed).",
"name": "func",
"type": "function",
"description": "The function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed)."
},
{
"directive": "returns",
"text": "nil",
"type": "nil"
}
],
"line": 22,
"namespace": "worldeditadditions_core",
"line_last": 29,
"name": "safe_region",
"instanced": false,
"args": [
"player_name",
"cmdname",
"func"
],
"text": "--- Captures the given function in the safe_region subsystem for later execution.\n-- CAUTION: This command is not available for general use.\n-- @internal\n-- @param\tplayer_name\t\tstring\t\tThe name of the player.\n-- @param\tcmdname\t\t\tstring\t\tThe name of the command being executed.\n-- @param\tfunc\t\t\tfunction\tThe function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed).\n-- @returns\tnil\nlocal function safe_region(player_name, cmdname, func)",
"params": [
{
"directive": "param",
"text": "player_name\t\tstring\t\tThe name of the player.",
"name": "player_name",
"type": "string",
"description": "The name of the player."
},
{
"directive": "param",
"text": "cmdname\t\t\tstring\t\tThe name of the command being executed.",
"name": "cmdname",
"type": "string",
"description": "The name of the command being executed."
},
{
"directive": "param",
"text": "func\t\t\tfunction\tThe function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed).",
"name": "func",
"type": "function",
"description": "The function to execute later. Will be passed NO ARGUMENTS should it ever get executed in the future (though its future execution is not guaranteed)."
}
],
"returns": {
"directive": "returns",
"text": "nil",
"type": "nil"
},
"examples": [],
"name_full": "worldeditadditions_core.safe_region",
"filename": "worldeditadditions_core/core/safe_region.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/core/safe_region.lua#L23-L30"
}
str_ends 🔗
Equivalent to string.endsWith in JS
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | The string to operate on |
substr_end | number | nil | The ending string to look for |
Returns
bool
:
Whether substr_end is present at the end of str
Source
--- Equivalent to string.endsWith in JS
-- @param str string The string to operate on
-- @param substr_end number The ending string to look for
-- @returns bool Whether substr_end is present at the end of str
local function str_ends(str, substr_end)
{
"type": "function",
"internal": false,
"description": "Equivalent to string.endsWith in JS",
"directives": [
{
"directive": "param",
"text": "str\t\t\tstring\tThe string to operate on",
"name": "str",
"type": "string",
"description": "The string to operate on"
},
{
"directive": "param",
"text": "substr_end\tnumber\tThe ending string to look for",
"name": "substr_end",
"type": "number",
"description": "The ending string to look for"
},
{
"directive": "returns",
"text": "bool\t\tWhether substr_end is present at the end of str",
"type": "bool",
"description": "Whether substr_end is present at the end of str"
}
],
"line": 32,
"namespace": "worldeditadditions_core",
"line_last": 36,
"name": "str_ends",
"instanced": false,
"args": [
"str",
"substr_end"
],
"text": "--- Equivalent to string.endsWith in JS\n-- @param\tstr\t\t\tstring\tThe string to operate on\n-- @param\tsubstr_end\tnumber\tThe ending string to look for\n-- @returns\tbool\t\tWhether substr_end is present at the end of str\nlocal function str_ends(str, substr_end)",
"params": [
{
"directive": "param",
"text": "str\t\t\tstring\tThe string to operate on",
"name": "str",
"type": "string",
"description": "The string to operate on"
},
{
"directive": "param",
"text": "substr_end\tnumber\tThe ending string to look for",
"name": "substr_end",
"type": "number",
"description": "The ending string to look for"
}
],
"returns": {
"directive": "returns",
"text": "bool\t\tWhether substr_end is present at the end of str",
"type": "bool",
"description": "Whether substr_end is present at the end of str"
},
"examples": [],
"name_full": "worldeditadditions_core.str_ends",
"filename": "worldeditadditions_core/utils/strings/polyfill.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/strings/polyfill.lua#L33-L37"
}
str_padend 🔗
Pads str to length len with char from right
Arguments
This function takes no arguments.
Returns
nil
Source
--- Pads str to length len with char from right
-- @source https://snipplr.com/view/13092/strlpad--pad-string-to-the-left
local function str_padend(str, len, char)
{
"type": "function",
"internal": false,
"description": "Pads str to length len with char from right",
"directives": [
{
"directive": "source",
"text": "https://snipplr.com/view/13092/strlpad--pad-string-to-the-left"
}
],
"line": 11,
"namespace": "worldeditadditions_core",
"line_last": 13,
"name": "str_padend",
"instanced": false,
"args": [
"str",
"len",
"char"
],
"text": "--- Pads str to length len with char from right\n-- @source https://snipplr.com/view/13092/strlpad--pad-string-to-the-left\nlocal function str_padend(str, len, char)",
"params": [],
"examples": [],
"name_full": "worldeditadditions_core.str_padend",
"filename": "worldeditadditions_core/utils/strings/polyfill.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/strings/polyfill.lua#L12-L14"
}
str_starts 🔗
Equivalent to string.startsWith in JS
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | The string to operate on |
start | number | nil | The start string to look for |
Returns
bool
:
Whether start is present at the beginning of str
Source
--- Equivalent to string.startsWith in JS
-- @param str string The string to operate on
-- @param start number The start string to look for
-- @returns bool Whether start is present at the beginning of str
local function str_starts(str, start)
{
"type": "function",
"internal": false,
"description": "Equivalent to string.startsWith in JS",
"directives": [
{
"directive": "param",
"text": "str\t\tstring\tThe string to operate on",
"name": "str",
"type": "string",
"description": "The string to operate on"
},
{
"directive": "param",
"text": "start\tnumber\tThe start string to look for",
"name": "start",
"type": "number",
"description": "The start string to look for"
},
{
"directive": "returns",
"text": "bool\tWhether start is present at the beginning of str",
"type": "bool",
"description": "Whether start is present at the beginning of str"
}
],
"line": 24,
"namespace": "worldeditadditions_core",
"line_last": 28,
"name": "str_starts",
"instanced": false,
"args": [
"str",
"start"
],
"text": "--- Equivalent to string.startsWith in JS\n-- @param\tstr\t\tstring\tThe string to operate on\n-- @param\tstart\tnumber\tThe start string to look for\n-- @returns\tbool\tWhether start is present at the beginning of str\nlocal function str_starts(str, start)",
"params": [
{
"directive": "param",
"text": "str\t\tstring\tThe string to operate on",
"name": "str",
"type": "string",
"description": "The string to operate on"
},
{
"directive": "param",
"text": "start\tnumber\tThe start string to look for",
"name": "start",
"type": "number",
"description": "The start string to look for"
}
],
"returns": {
"directive": "returns",
"text": "bool\tWhether start is present at the beginning of str",
"type": "bool",
"description": "Whether start is present at the beginning of str"
},
"examples": [],
"name_full": "worldeditadditions_core.str_starts",
"filename": "worldeditadditions_core/utils/strings/polyfill.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/strings/polyfill.lua#L25-L29"
}
sum 🔗
Adds up all the numbers in the given list
Arguments
Name | Type | Default value | Description |
---|---|---|---|
number[] | The list of numbers to add. | nil |
Returns
number
:
The sum total of all the numbers in the given list.
Source
--- Adds up all the numbers in the given list
-- @param number[] The list of numbers to add.
-- @returns number The sum total of all the numbers in the given list.
function wea_c.sum(list)
{
"type": "function",
"internal": false,
"description": "Adds up all the numbers in the given list",
"directives": [
{
"directive": "param",
"text": "number[]\tThe list of numbers to add.",
"name": "number[]",
"type": "The list of numbers to add."
},
{
"directive": "returns",
"text": "number\t\tThe sum total of all the numbers in the given list.",
"type": "number",
"description": "The sum total of all the numbers in the given list."
}
],
"line": 21,
"namespace": "worldeditadditions_core",
"line_last": 24,
"name": "sum",
"instanced": false,
"args": [
"list"
],
"text": "--- Adds up all the numbers in the given list\n-- @param\tnumber[]\tThe list of numbers to add.\n-- @returns\tnumber\t\tThe sum total of all the numbers in the given list.\nfunction wea_c.sum(list)",
"params": [
{
"directive": "param",
"text": "number[]\tThe list of numbers to add.",
"name": "number[]",
"type": "The list of numbers to add."
}
],
"returns": {
"directive": "returns",
"text": "number\t\tThe sum total of all the numbers in the given list.",
"type": "number",
"description": "The sum total of all the numbers in the given list."
},
"examples": [],
"name_full": "worldeditadditions_core.sum",
"filename": "worldeditadditions_core/utils/numbers.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/numbers.lua#L22-L25"
}
trim 🔗
Trims whitespace from a string from the beginning and the end. From http://lua-users.org/wiki/StringTrim
Arguments
Name | Type | Default value | Description |
---|---|---|---|
str | string | nil | The string to trim the whitespace from. |
Returns
string
:
A copy of the original string with the whitespace trimmed.
Source
--- Trims whitespace from a string from the beginning and the end.
-- From http://lua-users.org/wiki/StringTrim
-- @param str string The string to trim the whitespace from.
-- @returns string A copy of the original string with the whitespace trimmed.
local function trim(str)
{
"type": "function",
"internal": false,
"description": "Trims whitespace from a string from the beginning and the end.\nFrom http://lua-users.org/wiki/StringTrim",
"directives": [
{
"directive": "param",
"text": "str\t\tstring\tThe string to trim the whitespace from.",
"name": "str",
"type": "string",
"description": "The string to trim the whitespace from."
},
{
"directive": "returns",
"text": "string\tA copy of the original string with the whitespace trimmed.",
"type": "string",
"description": "A copy of the original string with the whitespace trimmed."
}
],
"line": 40,
"namespace": "worldeditadditions_core",
"line_last": 44,
"name": "trim",
"instanced": false,
"args": [
"str"
],
"text": "--- Trims whitespace from a string from the beginning and the end.\n-- From http://lua-users.org/wiki/StringTrim\n-- @param\tstr\t\tstring\tThe string to trim the whitespace from.\n-- @returns\tstring\tA copy of the original string with the whitespace trimmed.\nlocal function trim(str)",
"params": [
{
"directive": "param",
"text": "str\t\tstring\tThe string to trim the whitespace from.",
"name": "str",
"type": "string",
"description": "The string to trim the whitespace from."
}
],
"returns": {
"directive": "returns",
"text": "string\tA copy of the original string with the whitespace trimmed.",
"type": "string",
"description": "A copy of the original string with the whitespace trimmed."
},
"examples": [],
"name_full": "worldeditadditions_core.trim",
"filename": "worldeditadditions_core/utils/strings/polyfill.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/strings/polyfill.lua#L41-L45"
}
🔗
Splits a string into an array of arguments, respecting quoted sections. This function mimics shell-like argument parsing, handling both single and double quotes, as well as escaped characters within quotes.
Arguments
Name | Type | Default value | Description |
---|---|---|---|
text | string | nil | The input string to be split into arguments. |
Returns
table
:
An array of strings, each representing a parsed argument.
Source
--- Splits a string into an array of arguments, respecting quoted sections.
-- This function mimics shell-like argument parsing, handling both single and double quotes, as well as escaped characters within quotes.
--
-- @param text string The input string to be split into arguments.
-- @return table An array of strings, each representing a parsed argument.
--
{
"type": "function",
"internal": false,
"description": "Splits a string into an array of arguments, respecting quoted sections.\nThis function mimics shell-like argument parsing, handling both single and double quotes, as well as escaped characters within quotes.\n",
"directives": [
{
"directive": "param",
"text": "text\tstring\tThe input string to be split into arguments.",
"name": "text",
"type": "string",
"description": "The input string to be split into arguments."
},
{
"directive": "returns",
"text": "table\tAn array of strings, each representing a parsed argument.",
"type": "table",
"description": "An array of strings, each representing a parsed argument."
}
],
"line": 20,
"namespace": "worldeditadditions_core",
"line_last": 25,
"text": "--- Splits a string into an array of arguments, respecting quoted sections.\n-- This function mimics shell-like argument parsing, handling both single and double quotes, as well as escaped characters within quotes.\n-- \n-- @param\ttext\tstring\tThe input string to be split into arguments.\n-- @return\ttable\tAn array of strings, each representing a parsed argument.\n--",
"params": [
{
"directive": "param",
"text": "text\tstring\tThe input string to be split into arguments.",
"name": "text",
"type": "string",
"description": "The input string to be split into arguments."
}
],
"returns": {
"directive": "returns",
"text": "table\tAn array of strings, each representing a parsed argument.",
"type": "table",
"description": "An array of strings, each representing a parsed argument."
},
"examples": [],
"name_full": "worldeditadditions_core.undefined",
"filename": "worldeditadditions_core/utils/strings/split_shell.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/strings/split_shell.lua#L21-L26"
}
unwind_node_list 🔗
Unwinds a list of { node = string, weight = number } tables into a list of node ids. The node ids will be repeated multiple times according to their weights (e.g. an entry with a weight of 2 will be repeated twice).
Arguments
Name | Type | Default value | Description |
---|---|---|---|
list | table[] | nil | The list to unwind. |
Returns
number[],number
:
The unwound list of node ids, follows by the number of node ids in total.
Source
--- Unwinds a list of { node = string, weight = number } tables into a list of node ids.
-- The node ids will be repeated multiple times according to their weights
-- (e.g. an entry with a weight of 2 will be repeated twice).
-- @param list table[] The list to unwind.
-- @return number[],number The unwound list of node ids, follows by the number of node ids in total.
function wea_c.unwind_node_list(list)
{
"type": "function",
"internal": false,
"description": "Unwinds a list of { node = string, weight = number } tables into a list of node ids.\nThe node ids will be repeated multiple times according to their weights\n(e.g. an entry with a weight of 2 will be repeated twice).",
"directives": [
{
"directive": "param",
"text": "list\t\ttable[]\t\tThe list to unwind.",
"name": "list",
"type": "table[]",
"description": "The list to unwind."
},
{
"directive": "returns",
"text": "number[],number\t\t\tThe unwound list of node ids, follows by the number of node ids in total.",
"type": "number[],number",
"description": "The unwound list of node ids, follows by the number of node ids in total."
}
],
"line": 20,
"namespace": "worldeditadditions_core",
"line_last": 25,
"name": "unwind_node_list",
"instanced": false,
"args": [
"list"
],
"text": "--- Unwinds a list of { node = string, weight = number } tables into a list of node ids.\n-- The node ids will be repeated multiple times according to their weights\n-- (e.g. an entry with a weight of 2 will be repeated twice).\n-- @param\tlist\t\ttable[]\t\tThe list to unwind.\n-- @return\tnumber[],number\t\t\tThe unwound list of node ids, follows by the number of node ids in total.\nfunction wea_c.unwind_node_list(list)",
"params": [
{
"directive": "param",
"text": "list\t\ttable[]\t\tThe list to unwind.",
"name": "list",
"type": "table[]",
"description": "The list to unwind."
}
],
"returns": {
"directive": "returns",
"text": "number[],number\t\t\tThe unwound list of node ids, follows by the number of node ids in total.",
"type": "number[],number",
"description": "The unwound list of node ids, follows by the number of node ids in total."
},
"examples": [],
"name_full": "worldeditadditions_core.unwind_node_list",
"filename": "worldeditadditions_core/utils/nodes.lua",
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/blob/dev/worldeditadditions_core/utils/nodes.lua#L21-L26"
}
Events
pre-parse 🔗
Command execution pipeline: before paramtext
parsing but after validation.
See worldeditadditions_core.run_command
Format
{ player_name: string, cmddef: table, paramtext: string }
Source
--- Command execution pipeline: before `paramtext` parsing but after validation.
--
-- See `worldeditadditions_core.run_command`
-- @event pre-parse
-- @format { player_name: string, cmddef: table, paramtext: string }
{
"type": "event",
"internal": false,
"description": "Command execution pipeline: before `paramtext` parsing but after validation.\n\nSee `worldeditadditions_core.run_command`",
"directives": [
{
"directive": "event",
"text": "pre-parse"
},
{
"directive": "format",
"text": "{ player_name: string, cmddef: table, paramtext: string }"
}
],
"line": 91,
"namespace": "worldeditadditions_core",
"event": "pre-parse",
"line_last": 96,
"text": "--- Command execution pipeline: before `paramtext` parsing but after validation.\n-- \n-- See `worldeditadditions_core.run_command`\n-- @event\tpre-parse\n-- @format\t{ player_name: string, cmddef: table, paramtext: string }",
"params": [],
"examples": [],
"filename": "worldeditadditions_core/core/run_command.lua"
}