For working with chunks.
A chunk represents a 32 tile2 on a surface in Factorio.
local Chunk = require('stdlib/area/chunk')
from_position (position) | Gets the chunk position of a chunk where the specified position resides. |
get_data (surface, chunk_pos[, default_value]) | Gets the user data that is associated with a chunk. |
get_index (surface, chunk_pos) | Calculates and returns a stable and deterministic integer ID of a chunk from a given chunk position. |
set_data (surface, chunk_pos, data) | Associates the user data to a chunk. |
to_area (chunk_pos) | Gets the area of a chunk from the specified chunk position. |
Gets the chunk position of a chunk where the specified position resides.
Parameters:
local chunk_x = Chunk.from_position(pos).x
Gets the user data that is associated with a chunk.
The user data is stored in the global object and it persists between loads.
Parameters:Calculates and returns a stable and deterministic integer ID of a chunk from a given chunk position.
The chunk ID will not change once it is calculated.
Parameters:Associates the user data to a chunk.
The user data will be stored in the global object and it will persist between loads.
Parameters:Gets the area of a chunk from the specified chunk position.
Parameters: