Dev - Data Types

Stranded III is using several different data types in Lua. This section gives you a short overview over all used data types.


Stranded III uses several different primitive data types in Lua scripts and the command reference.
  • bool

    A boolean value. Can be expressed in Lua with the keywords true or false or with logical expressions. All data in Lua is considered to be true except for false and nil.
    Lua reference on booleans
  • int

    An integer value. In Lua it's represented by a number (double). E.g.: 42
    Lua reference on numbers
  • float

    A flot value. In Lua it's represented by a number (double). E.g.: 3.1415
    Lua reference on numbers
  • string

    A string. Denoted with single or double quotes in Lua or alternatively with [[ and ]]. E.g. "hello world".
    Concatenation of strings and other values is possible with the ..-operator.
    Lua reference on strings


A complex data type representing an RGBA color value. It can be stated in multiple different ways.


Stranded III returns colors as tuples of 4 return values: r, g, b (integer 0-255) and a (float 0-1)

Lua Table

The first and most common way to specify a color as a Lua table. The structure is:
{r, g, b, a}
The components are defined this way:
  • red: an integer value from 0 - 255 (default: 255)
  • green: an integer value from 0 - 255 (default: 255)
  • blue: an integer value from 0 - 255 (default: 255)
  • alpha: a float value from 0 - 1 (default: 1.0)
To reduce writing effort you can omit some values in your table. Allowed color table shortcut notations:
  • {br} translates to { r=br, g=br, b=br, a=1.0 } - use this to define a grayscale brightness
  • {br, a} translates to { r=br, g=br, b=br, a=a } - use this to define a grayscale brightness with transparency
  • {r, g, b} translates to { r=r, g=g, b=b, a=1.0 } - use this to define a color but no transparency
{255, 0, 0}, {0, 100, 0}, {0, 0, 255}, {120, 120, 0}, {255, 128, 0}, {128}, {0}, {255,0,0,0.5}, {0,0.3}

HEX String (HTML/CSS Style)

Colors can be defined as hex strings by using strings starting with #.
Each color component is defined by a value from 00 (0) to FF (255). Possible formats are:
  • "#RGB", E.g.: "#F00" for red (internally expands to #FF0000)
  • "#RGBA", E.g.: "#0F08" for a semi-transparent green (internally expands to #00FF0088)
  • "#RRGGBB", E.g.: "#0000FF" for blue
  • "#RRGGBBAA", E.g.: "FFFF0088" for a semi-transparent yellow

Color Keyword (CSS3/SVG)

It's even possible to use CSS3 extended color keywords. E.g.: "lime" or "mediumvioletred".
See for a complete list


When you pass a boolean the color will simply be black (false) or white (true).


A complex data type representing the rendering order of a sprite object from the s3sprite library. The order is defined by two separate values:
  • Sorting Layer: The main rendering order, there is a limited number of sorting layers
  • Order: A positive or negative value for a finer order within the sorting layer. The higher the value is the later the sprite is rendererd (= more in the foreground).

Lua Table

When you want to define both values, you have to use a Lua table. The structure is:
{layer, order}
{s3sprite.layers.foreground, 5}
The following layers are available (from absoluteBackground [rendered first] to debug [rendered last]):
  • s3sprite.layers.absoluteBackground
  • s3sprite.layers.background
  • s3sprite.layers.default
  • s3sprite.layers.layer1
  • s3sprite.layers.layer2
  • s3sprite.layers.layer3
  • s3sprite.layers.layer4
  • s3sprite.layers.layer5
  • s3sprite.layers.layer6
  • s3sprite.layers.layer7
  • s3sprite.layers.layer8
  • s3sprite.layers.layer9
  • s3sprite.layers.foreground
  • s3sprite.layers.hud
  • s3sprite.layers.cursor
  • s3sprite.layers.tooltips
  • s3sprite.layers.absoluteForeground
  • s3sprite.layers.debug


You can also just define the order as a simple number. The sorting layer will then be the "default"-layer (s3sprite.layers.default). E.g.:
is the same as writing:
{s3sprite.layers.default, 1000}