Difference between revisions of "Datatypes"
(initial import) |
(fix category) |
||
(One intermediate revision by the same user not shown) | |||
Line 20: | Line 20: | ||
num - A real (double-precision floating-point) number. You can also specify an integer without any problems. | num - A real (double-precision floating-point) number. You can also specify an integer without any problems. | ||
+ | |||
+ | [[Category:Scripting]] |
Latest revision as of 00:14, 3 August 2013
This page provides an overview of the common datatypes used in Bitfighter Lua scripts.
Point
Point is a low-overhead custom structure that represents an xy coordinate pair. See the point class documentation for further details.
Note that points are immutable, so cannot be changed once created.
Geometry
Geometry is not a formal datatype, but rather a reference to either to a point or a table of points, depending on the context. For example, if the object is inherently point-like (such as an Item or Projectile), then geometry is a Point. For more complex objects (such as a WallItem or a Zone), geometry refers to a Lua table of points. Some objects have a specific number of points. A TextItem, for example, consists of exactly two points, defining its start and endpoints. Some items (like Zones and PolyWalls ) must have a minimum of three points. See the documentation for individual items for details.
The Geom class provides a collection of tools to make common transformations to a point or a table of points.
Other Datatypes
bool - Either true or false. In Lua, both nil and false make a condition false; any other value makes it true.
int - A number that has no decimal component. Unlike some languages, Lua does not distinguish between integers and floating point numbers – they are both stored internally as numbers. When a function requires an integer argument, and you provide a floating point number, the fraction will be silently dropped.
num - A real (double-precision floating-point) number. You can also specify an integer without any problems.