Component: Geolyzer

This component is provided by the geolyzer block.

Component name: geolyzer.
Callbacks:

Following code snippet can be used to get a grasp of how the scan function works in practice. It scans an area of specified size at a specified offset, saves the returned data along with correct offsets from the geolyzer block (or robot) and prints those.

local component = require("component")
local geolyzer = component.geolyzer
 
local offsetx = 4
local offsetz = -3
local offsety = -5
 
local sizex = 3
local sizez = 4
local sizey = 5
 
local map = {}
local scanData = geolyzer.scan(offsetx, offsetz, offsety, sizex, sizez, sizey)
local i = 1
for y = 0, sizey - 1 do
    for z = 0, sizez - 1 do
        for x = 0, sizex - 1 do
            -- alternatively when thinking in terms of 3-dimensional table: map[offsety + y][offsetz + z][offsetx + x] = scanData[i]
            map[i] = {posx = offsetx + x, posy = offsety + y, posz = offsetz + z, hardness = scanData[i]}
            i = i + 1
        end
    end
end
 
for i = 1, sizex*sizez*sizey do
    print(map[i].posx, map[i].posy, map[i].posz, map[i].hardness)
end