# Documentation for *GridObject*
## Overview
class overview...
## Parent classes
* [CObject](LuaFunctionDoc_CObject.md.html)
* ColorizableObject
* FXObject
* InitDone
* [Object](LuaFunctionDoc_Object.md.html)
* PropertyObject
* SyncObject
## HexGridGetObject
Returns the first found object (or nil) in a grid that is located in the hex defined by q, r, and that match all optianal filters.
Lua_Obj ret **HexGridGetObject**(grid, int q, int r[, string class, string ignore-class, functor filter])
grid
: HSL::Grid compliant grid, should have enough bits to store handles. Generally this is the ObjectGrid Lua global variable.
int q, int r
: Hex axial coordinates of the target hex.
string class
: Optional. Only objects of this class, if any, will be returned.
string ignore
: class - Optional. Objects of this class will be ignored.
functor filter
: Optional. Lua function that accepts a single argument, the current object being analyzed. If the function returns true the object will be accepted, false/nil the object will be skipped, "break" (as string) the object will be accpeted and further iteration will be stopped.
_returns_ Lua_Obj ret
: First found object or nil if none were found.
## HexGridGetObjects
Returns a Lua int based array that contains all objects in a grid that are located in the hex defined by pos or q, r, and that match all optianal filters.
table ret **HexGridGetObjects**(grid, point pos[, string class, string ignore-class, functor filter])
table ret **HexGridGetObjects**(grid, int q, int r[, string class, string ignore-class, functor filter])
grid
: HSL::Grid compliant grid, should have enough bits to store handles. Generally this is the ObjectGrid Lua global variable.
point pos
: A point that defines a hex with it's x, y members in hex axial coordinates.
int q, int r
: Hex axial coordinates of the target hex.
string class
: Optional. Only objects of this class, if any, will be returned.
string ignore
: class - Optional. Objects of this class will be ignored.
functor filter
: Optional. Lua function that accepts a single argument, the current object being analyzed. If the function returns true the object will be accepted, false/nil the object will be skipped, "break" (as string) the object will be accpeted and further iteration will be stopped.
_returns_ table ret
: Lua int based array containing all matching objects, or an empty table if none were found.
## HexGridGetObjectsInRange
Returns a Lua int based array that contains all objects in a grid that are located in the hex defined by pos or q, r, and it's neighbouring hexes within range, and that match all optianal filters.
table ret **HexGridGetObjectsInRange**(grid, point pos, int range[, string class, string ignore-class, functor filter])
table ret **HexGridGetObjectsInRange**(grid, int q, int r, int range[, string class, string ignore-class, functor filter])
grid
: HSL::Grid compliant grid, should have enough bits to store handles. Generally this is the ObjectGrid Lua global variable.
point pos
: A point that defines a hex with it's x, y members in hex axial coordinates.
int q, int r
: Hex axial coordinates of the target hex.
int range
: Hex axial distance range. In other words, 1 means 1 hex distance. So a call with 0 would consider the q, r hex only, a call with 1 will consider q, r and adjacents.
string class
: Optional. Only objects of this class, if any, will be returned.
string ignore
: class - Optional. Objects of this class will be ignored.
functor filter
: Optional. Lua function that accepts a single argument, the current object being analyzed. If the function returns true the object will be accepted, false/nil the object will be skipped, "break" (as string) the object will be accpeted and further iteration will be stopped.
_returns_ table ret
: Lua int based array containing all matching objects, or an empty table if none were found.
## HexGridShapeAddObject
Applies an object to a grid, taking care of object co-habitation. The hexes in which the object is added are defined by the object's position, rotation and the shape provided.
void **HexGridShapeAddObject**(grid, obj, shape)
grid
: HSL::Grid compliant grid, should have enough bits to store handles. Generally this is the ObjectGrid Lua global variable.
obj
: Lua Object with a handle.
shape
: Building shape to apply the object in. An array of 2d points which represent hex axial offsets from the hex where the object's position would place it.
## HexGridShapeGetObjectList
Returns a Lua int based array that contains all objects in a grid that are located in hexes defined by the provided object position, rotation and shape, and match all optional filters. Alternatively it can be used as an iterator method where the filter function will be called for objects matching the query defined by the method's other params.
table ret **HexGridShapeGetObjectList**(grid, obj, shape[, string class, string ignore-class, functor filter])
grid
: HSL::Grid compliant grid, should have enough bits to store handles. Generally this is the ObjectGrid Lua global variable.
obj
: Any CObject, it is used to position and rotate the shape.
shape
: Building shape to analyze. An array of 2d points which represent hex axial offsets from the hex where the object's position would place it.
string class
: Optional. Only objects of this class, if any, will be returned.
string ignore
: class - Optional. Objects of this class will be ignored.
functor filter
: Optional. Lua function that accepts a single argument, the current object being analyzed. If the function returns true the object will be accepted, false/nil the object will be skipped, "break" (as string) the object will be accpeted and further iteration will be stopped.
_returns_ table ret
: Lua int based array containing all matching objects, or an empty table if none were found.
## HexGridShapeRemoveObject
Removes an object from a grid, taking care of object co-habitation. The hexes from which the object is removed are defined by it's position, rotation and the provided shape. It is paramount that the hexes cleared are the same hexes where the building was first applied with HexGridShapeAddObject.
void **HexGridShapeRemoveObject**(grid, obj, shape)
grid
: HSL::Grid compliant grid, should have enough bits to store handles. Generally this is the ObjectGrid Lua global variable.
obj
: Lua Object with a handle.
shape
: Building shape to apply the object in. An array of 2d points which represent hex axial offsets from the hex where the object's position would place it.
(insert footer.md.html here)