Source: assets/modules/xs_containers.wren
Logical representation of a (game) grid
construct new(width, height, zero) ↗Creates a new grid with the given dimensions, filled with a default value
width ↗The number of columns in the grid.
height ↗The number of rows in the grid.
swapValues(x1, y1, x2, y2) ↗Swaps the values of two given grid cells.
valid(x, y) ↗Checks if a given cell position exists in the grid.
[x, y] ↗Returns the value stored at the given grid cell.
[x, y]=(v) ↗Assigns a given value to a given grid cell.
toString ↗Constructs a string representation of this grid.
Logical representation of a grid with many empty spaces
construct new() ↗Creates a new empty sparse grid
static makeId(x, y) ↗Creates a unique identifier for a given cell position.
has(x, y) ↗Checks if a given cell position exists in the grid.
remove(x, y) ↗Removes the value stored at the given grid cell.
[x, y] ↗Returns the value stored at the given grid cell.
[x, y]=(v) ↗Assigns a given value to a given grid cell.
clear() ↗Clears the grid.
values ↗Returns the values stored in the grid.
First-in-first-out (FIFO) data structure
construct new() ↗Creates a new empty queue
push(val) ↗Adds a value to the back of the queue
pop() ↗Removes and returns the value from the front of the queue
empty() ↗Checks if the queue is empty
Last-in-first-out (LIFO) data structure (stack)
construct new() ↗Creates a new empty dequeue
push(val) ↗Adds a value to the top of the stack
pop() ↗Removes and returns the value from the top of the stack
empty() ↗Checks if the dequeue is empty
A simple ring buffer (circular buffer) implementation
construct new(size, value) ↗Creates a new ring buffer of the given size, filled with a default value
push(value) ↗Adds a value to the buffer, overwriting the oldest value if full
peek() ↗Returns the most recently added value
[index] ↗Gets a value at the given offset from the current position
size ↗Gets the size of the ring buffer