-
Notifications
You must be signed in to change notification settings - Fork 4
Grid
The grid class stores a matrix of values.
grid.new()
or
grid()
Returns a new grid object.
grid:set(x,y,v)
Sets a value for the given grid coordinates. The coordinates must be integers.
grid:get(x,y)
Returns the value associated with the given coordinates.
grid:clear()
Clears the grid of all values.
grid:rectangle(x,y,x2,y2[,skipNil])
Returns an iterator. The iterator function iterates over all coordinates in the rectangle and returns x,y,v. If skipNil is true, then the iterator will skip all nil values.
grid:iterate()
Returns an iterator. The iterator function iterates through all non-nil values in the grid and returns x,y,v.
grid:map(func)
Iterates through all coordinates and call func to set new values such that newv = func(x,y,v).
grid(x,y)
Shortcut for grid:get