Colours - mattbichay/test GitHub Wiki

Table of Contents

Colours

A Colour (`Colourf` or `Colourb`) is a basic type. It has four properties for red, green, blue, and alpha. Colourf has them as `float`s bound between 0.0 and 1.0. Colourb has them as `int`s bound between 0 and 255.

Colourb

 `Colourb `'''new'''(`int` ''red'', `int` ''green'', `int` ''blue'', `int` ''alpha'')::
   Creates a new ''Colourb'' for use in Lua.
 '''red'''`   `(`int`)::
   ''red'' property. Read & write.
 '''green'''`   `(`int`)::
   ''green'' property. Read & write.
 '''blue'''`   `(`int`)::
   ''blue'' property. Read & write.
 '''alpha'''`   `(`int`)::
   ''alpha'' property. Read & write.
 '''rgba'''`   `(`int,int,int,int`)::
   Returns four separate values (not a table) representing the four properties of the Colourb. Read & write. When writing, all of them are optional. You may only wish to set r and g, so only pass those two. However, if you want to set only r and a, then you must pass all of them, because there is no way to tell which ones you want omitted.

For info on how to read operator overload documentation, see the beginning of the [wiki:documentation/LuaManual/Vectors#Overloadedoperators].

 `bool `operator '''=='''(`Colourb` ''lhs'', `Colourb` ''rhs'')::
   Equality
 `Colourb `operator '''+'''(`Colourb` ''lhs'', `Colourb` ''rhs'')::
   Addition
 `Colourb `operator '''*'''(`Colourb` ''lhs'', `float` ''rhs'')::
   Multiplication. Linear scaling ''lhs''.

Colourf

 `Colourf `'''new'''(`float` ''red'', `float` ''green'', `float` ''blue'', `float` ''alpha'')::
   Creates a new ''Colourf'' for use in Lua.
 '''red'''`   `(`float`)::
   ''red'' property. Read & write.
 '''green'''`   `(`float`)::
   ''green'' property. Read & write.
 '''blue'''`   `(`float`)::
   ''blue'' property. Read & write.
 '''alpha'''`   `(`float`)::
   ''alpha'' property. Read & write.
 '''rgba'''`   `(`float,float,float,float`)::
   Returns four separate values (not a table) representing the four properties of the Colourf. Read & write. When writing, all of them are optional. You may only wish to set r and g, so only pass those two. However, if you want to set only r and a, then you must pass all of them, because there is no way to tell which ones you want omitted.

For info on how to read operator overload documentation, see the beginning of the [wiki:documentation/LuaManual/Vectors#Overloadedoperators].

 `bool `operator '''=='''(`Colourf` ''lhs'', `Colourf` ''rhs'')::
   Equality

Colour.rgba Example

Because it cannot be clearly expressed in words, this is an example of things that work and things that don't.

⚠️ **GitHub.com Fallback** ⚠️