Home / Region

region()

region(x1, y1, z1, x2, y2, z2) region(boundsTable)

Creates an inclusive cuboid helper for area operations. Bounds are floored to block coordinates and reordered so each minimum is below its matching maximum.

Parameters

NameTypeDescription
x1, y1, z1numberStarting coordinates.
x2, y2, z2numberEnding coordinates.
boundsTabletableEither an array with six coordinates or a table with minX/minY/minZ/maxX/maxY/maxZ.

Returns

A region object with various helper methods.

Example

local x, y, z = world.spawn()
local area = region(x - 4, y - 1, z - 4, x + 4, y - 1, z + 4)
area:fill(89) -- fill area with glowstone