script

Methods

get_file

Returns the script's filename (excluding the extension)

function script.get_file(): string
-- example usage
local file = script.get_file()

get_unix

Returns the unix timestamp (in seconds) at which the script was loaded

function script.get_unix(): int
-- example usage
local unix = script.get_unix()

get_name

Returns the name of the script

function script.get_name(): string
-- example usage
local name = script.get_name()

set_name

Sets the name of the script

function script.set_name(name: string): void
-- example usage
script.set_name("Example")

get_desc

Returns the description of the script

function script.get_desc(): string
-- example usage
local desc = script.get_desc()

set_desc

Sets the description of the script

function script.set_desc(desc: string): void
-- example usage
script.set_desc("Example")

on_shutdown

Registers a function that will be called when the script shuts down

function script.on_shutdown(routine: function): void
-- example usage
script.on_shutdown(function()
    -- do something on shutdown
end)

keep_alive

Marks the script as persistent so it will stay loaded after the main thread has finished executing

function script.keep_alive(): void
-- example usage
script.keep_alive()