Lua_api.txt: Add documentation of VoxelArea 'ystride', 'zstride' (#9415)

This commit is contained in:
Paramat 2020-02-22 01:11:33 +00:00 committed by GitHub
parent d507047443
commit 2df226bb41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3777,6 +3777,28 @@ The coordinates are *inclusive*, like most other things in Minetest.
`[z [y [x]]]`. `[z [y [x]]]`.
* `iterp(minp, maxp)`: same as above, except takes a vector * `iterp(minp, maxp)`: same as above, except takes a vector
### Y stride and z stride of a flat array
For a particular position in a voxel area, whose flat array index is known,
it is often useful to know the index of a neighboring or nearby position.
The table below shows the changes of index required for 1 node movements along
the axes in a voxel area:
Movement Change of index
+x +1
-x -1
+y +ystride
-y -ystride
+z +zstride
-z -zstride
If, for example:
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
The values of `ystride` and `zstride` can be obtained using `area.ystride` and
`area.zstride`.