Loaded as one of the noise expressions listed in this union, based on the value of the type
key.
A fragment of a functional program used to generate coherent noise, probably for purposes related to terrain generation.
Noise expressions can be provided as table literals or built using functions in the built-in noise library. The built-in noise library allows writing much more concise code, so its usage will be shown in most examples for noise expressions.
noise.define_noise_function allows noise expressions to be defined using a shorthand that's a subset of Lua (see the example for details).
See here for a tutorial on authoring noise expressions.
NoiseVariable | Loaded when the |
NoiseFunctionApplication | Loaded when the |
NoiseLiteralBoolean | Loaded when the |
NoiseLiteralNumber | Loaded when the |
NoiseLiteralString | Loaded when the |
NoiseLiteralObject | Loaded when the |
NoiseLiteralExpression | Loaded when the |
NoiseArrayConstruction | Loaded when the |
NoiseProcedureDelimiter | Loaded when the |
NoiseIfElseChain | Loaded when the |
-- "noise" library required beforehand
expression = noise.define_noise_function(function(x, y, tile, map)
return (x + y) / 1000
end)
expression = {
type = "function-application",
function_name = "divide",
arguments = {
{
type = "function-application",
function_name = "add",
arguments = {
{
type = "variable",
variable_name = "x"
},
{
type = "variable",
variable_name = "y"
}
}
},
{
type = "literal-number",
literal_value = 1000
}
}
}