diff --git a/lua_api.html b/lua_api.html index ef8ca8d..e9b16ed 100644 --- a/lua_api.html +++ b/lua_api.html @@ -246,26 +246,30 @@ layout: default
If you have any difficulty in understanding this, please read Programming in Lua.
minetest.registered_*
tables.
minetest.register_biome(biome definition)
minetest.registered_biome
with the key of biome.name
biome.name
is nil, the key is the returned IDminetest.register_ore(ore definition)
minetest.registered_*
tables.
minetest.clear_registered_ores()
minetest.register_schematic(schematic definition)
minetest.registered_schematic
with the key of schematic.name
schematic.name
is nil, the key is the returned IDclears all ores currently registered
+minetest.clear_registered_biomes()
minetest.clear_registered_ores()
minetest.clear_registered_decorations()
minetest.clear_registered_schematics()
Note that in some cases you will stumble upon things that are not contained in these tables (e.g. when a mod has been removed). Always check for existence before trying to access the fields.
@@ -1848,7 +1885,7 @@ value must (always) be two hexadecimal digits.minetest
namespace referenceminetest.get_current_modname()
: returns a stringminetest.get_current_modname()
: returns the currently loading mod's name, when we are loading a modminetest.get_modpath(modname)
: returns e.g. "/home/user/.minetest/usermods/modname"
.lua
modules or static data from modminetest.auth_reload
call the authetification handler.
should be applied to the default config or current active configminetest.generate_ores(vm, p1, p2)
vm
and in the area from p1 to p2.minetest.generate_decorations(vm, p1, p2)
vm
and in the area from p1 to p2.minetest.generate_ores(vm, pos1, pos2)
vm
and in the area from pos1
to pos2
.pos1
and pos2
are optional and default to mapchunk minp and maxp.minetest.generate_decorations(vm, pos1, pos2)
vm
and in the area from pos1
to pos2
.pos1
and pos2
are optional and default to mapchunk minp and maxp.minetest.clear_objects()
minetest.auth_reload
call the authetification handler.
ignore
are replaced by the schematicminetest.serialize_schematic(schematic, format, options)
format
of either "mts" or "lua".options
is a table containing the following optional parameters:use_comments
is true and format
is "lua", the Lua code generated will have (X, Z)register_after_load
is true, then schematic
, if not yet loaded, will be registeredPlease note that forceloaded areas are saved when the server restarts.
+minetest.global_exists(name) +^ Checks if a global variable has been set, without triggering a warning.
minetest.env
: EnvRef
of the server environment and world.nil
.
Returns taken ItemStack
.PseudoRandom
A pseudorandom number generator.
+A 16-bit pseudorandom number generator. +Uses a well-known LCG algorithm introduced by K&R.
It can be created via PseudoRandom(seed)
.
nil
.
PcgRandom
A 32-bit pseudorandom number generator. +Uses PCG32, an algorithm of the permuted congruential generator family, offering very strong randomness.
+It can be created via PcgRandom(seed)
or PcgRandom(seed, sequence)
.
next()
: return next integer random number [-2147483648
...2147483647
]next(min, max)
: return next integer random number [min
...max
]rand_normal_dist(min, max, num_trials=6)
: return normally distributed random number [min
...max
]PerlinNoise
A perlin noise generator.
It can be created via PerlinNoise(seed, octaves, persistence, scale)
or PerlinNoise(noiseparams)
.
Alternatively with minetest.get_perlin(seeddiff, octaves, persistence, scale)
or minetest.get_perlin(noiseparams)
.
get2d(pos)
: returns 2D noise value at pos={x=,y=}
get3d(pos)
: returns 3D noise value at pos={x=,y=,z=}
minetest.get_perlin(noiseparams)
.
Format of size
is {x=dimx, y=dimy, z=dimz}
. The z
conponent is ommitted
for 2D noise, and it must be must be larger than 1 for 3D noise (otherwise
nil
is returned).
get2dMap(pos)
: returns a <size.x>
times <size.y>
2D array of 2D noise
with values starting at pos={x=,y=}
An interface to the MapVoxelManipulator
for Lua.
It can be created via VoxelManip()
or minetest.get_voxel_manip()
.
The map will be pre-loaded if two positions are passed to either.
read_from_map(p1, p2)
: Reads a chunk of map from the map containing the
region formed by p1
and p2
.A helper class for voxel areas.
It can be created via VoxelArea:new{MinEdge=pmin, MaxEdge=pmax}
.
The coordinates are inclusive, like most other things in Minetest.
getExtent()
: returns a 3D vector containing the size of the area formed by
MinEdge
and MaxEdge
Settings
An interface to read config files in the format of minetest.conf
.
It can be created via Settings(filename)
.
get(key)
: returns a valueget_bool(key)
: returns a booleanregister_decoration
)