Skip to content

Global Functions

Tempestissiman edited this page Jul 26, 2022 · 5 revisions

Descriptions

Functions accessible anywhere within a lua script.

Remarks

A few functions are shared with macros, so that's why they seem a bit redundant.


addScenecontrol(name, arguments, definition)

Descriptions

Define a custom scenecontrol type.

Parameters

Name Type Description
name string The scenecontrol type's name
arguments number / Table (of string) If number: represent the number of arguments of this scenecontrol type. If table, lists the name of each arguments of this scenecontrol type
definition function A function with a scenecontrol command as an input that defines the behaviour of this scenecontrol type

Return types

nil

Remarks

name must not be the same as any other scenecontrol type's name already defined beforehand.

Example

addScenecontrol("myType", 3, function(cmd)
    log(cmd.timing)
    log(cmd.args[1])
    log(cmd.args[2])
    log(cmd.args[3])
end)
addScenecontrol("myType", {"myArg1", "myArg2"}, function(cmd)
    log(cmd.timing)
    log(cmd.args[1])
    log(cmd.args[2])
end)
addScenecontrol("myType", 0, function(cmd)
    log(cmd.timing)
end)

log(object)

Descriptions

Writing to the log file.

Parameters

Name Type Description
object any Object to be logged

Return types

nil

Remarks

The result can be viewed by pressing the "Error Log" button on the left side of the screen.

Example

log("Hello, world!")
log(616)
log(Channel.keyframe())

notify(object)

Descriptions

Displaying a toast notification.

Parameters

Name Type Description
object any Object to be displayed

Return types

nil

Remarks

_

**Example

notify("Hello, world!")
notify(616)
notify(Channel.keyframe())

xy(x, y)

Descriptions

Create a XY object.

Parameters

Name Type Description
x number The x component
y number The y component

Return types

XY

Remarks

_

Example

local coordinate = xy(1, 2)

xyz(x, y, z)

Descriptions

Create a XYZ object.

Parameters

Name Type Description
x number The x component
y number The y component
z number The z component

Return types

XYZ

Remarks

_

Example

local coordinate = xyz(1, 2, 3)

rgba(r, g, b, a)

Descriptions

Create an RGBA object.

Parameters

Name Type Description
r number The red value (0-255)
g number The blue value (0-255)
b number The green value (0-255)
a number The alpha value (0-255)

Return types

RGBA

Remarks

_

Example

local whiteColor = rgba(255, 255, 255, 255)

hsva(h, s, v, a)

Descriptions

Create an HSVA object.

Parameters

Name Type Description
h number The hue value (0-360)
s number The saturation value (0-1)
v number The brightness value (0-1)
a number The alpha value (0-1)

Return types

HSVA

Remarks

_

Example

local color = hsva(180, 1, 1, 1)

toNumber(s)

Descriptions

Convert a string to a number.

Parameters

Name Type Description
s string The string to convert to number

Return types

number

Remarks

_

Example

local num = toNumber("100")

toBool(s)

Descriptions

Convert a string to a boolean value.

Parameters

Name Type Description
s string The string to convert to boolean

Return types

boolean

Remarks

_

Example

local num = toBool("true")

Clone this wiki locally