Home / World

world.get()

world.get(x, y, z) -> blockId, metadata

Reads the block ID and metadata at the given block coordinates.

Parameters

NameTypeDescription
x, y, znumberBlock coordinates.

Returns

Two numbers: the block ID and the metadata value.

Example

local id, meta = world.get(0, 64, 0)
log('Block at 0,64,0 is ' .. id .. ':' .. meta)

if id == 0 then
  log('That is air')
end

Notes

The API reads the primary server world's block data. Avoid scanning large areas synchronously in one tick.