Skip to main content

GlobalRef

Object representing an global instance

Properties

path

GlobalRef.path: string

Get the path of the reference

Functions

GlobalRef()

GlobalRef(
valuestring--

sub directory

) → GlobalRef

Returns a reference to a nested variable Variables are nested using underscores.

clear

GlobalRef:clear() → ()

Clear the value of the variable so that it is empty

empty

GlobalRef:empty() → boolean

Checks if the value of the variable is empty A variable is empty if its string value is ""

set

GlobalRef:set(
valnil | boolean | number | string--

value to set

) → ()

Set the value of the variable

def

GlobalRef:def(
valnil | boolean | number | string--

value to set

) → GlobalRef--

self reference

Set the value of the variable if it is empty

str

GlobalRef:str() → string

Get the string value of the variable As all variables have a string representation, never return nil.

bool

GlobalRef:bool() → booleanean | nil

Get the boolean value of the variable If the variable is of the wrong type, return nil.

int

GlobalRef:int() → number | nil

Get the integer value of the variable If the variable is of the wrong type, return nil.

float

GlobalRef:float() → number | nil

Get the float value of the variable If the variable is of the wrong type, return nil.

once

GlobalRef:once() → boolean

Return true once and false afterwards

toggle

GlobalRef:toggle() → boolean

Return true and false alternating

Show raw api
{
    "functions": [
        {
            "name": "__call",
            "desc": "Returns a reference to a nested variable\nVariables are nested using underscores.",
            "params": [
                {
                    "name": "value",
                    "desc": "sub directory",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "GlobalRef"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 14,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "clear",
            "desc": "Clear the value of the variable so that it is empty",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 29,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "empty",
            "desc": "Checks if the value of the variable is empty\nA variable is empty if its string value is \"\"",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 37,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "set",
            "desc": "Set the value of the variable",
            "params": [
                {
                    "name": "val",
                    "desc": "value to set",
                    "lua_type": "nil|boolean|number|string"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 45,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "def",
            "desc": "Set the value of the variable if it is empty",
            "params": [
                {
                    "name": "val",
                    "desc": "value to set",
                    "lua_type": "nil|boolean|number|string"
                }
            ],
            "returns": [
                {
                    "desc": "self reference",
                    "lua_type": "GlobalRef"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 54,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "str",
            "desc": "Get the string value of the variable\nAs all variables have a string representation, never return nil.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 64,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "bool",
            "desc": "Get the boolean value of the variable\nIf the variable is of the wrong type, return nil.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "booleanean|nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 73,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "int",
            "desc": "Get the integer value of the variable\nIf the variable is of the wrong type, return nil.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number|nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 82,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "float",
            "desc": "Get the float value of the variable\nIf the variable is of the wrong type, return nil.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number|nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 91,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "once",
            "desc": "Return true once and false afterwards",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 99,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        },
        {
            "name": "toggle",
            "desc": "Return true and false alternating",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 107,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "path",
            "desc": "Get the path of the reference",
            "lua_type": "string",
            "source": {
                "line": 24,
                "path": "../../res/data/script/lib/system/global_ref.lua"
            }
        }
    ],
    "types": [],
    "name": "GlobalRef",
    "desc": "Object representing an global instance",
    "source": {
        "line": 5,
        "path": "../../res/data/script/lib/system/global_ref.lua"
    }
}