Skip to main content

Resource

Shared Functions

NameDescription
GetStateReturns the state of the specified resource.
GetCurrentNameReturns the name of the currently executing resource.
CallCalls an exported function in the specified resource.

Server Functions

NameDescription
StartStart a resource.
StopStop a resource.
RestartRestart a resource.

GetState

Returns the state of the specified resource.

string state = Resource.GetState(string resource)

info

Possible states are:
"unknown"
"started"
"loaded"
"stopped"


GetCurrentName

Returns the name of the currently executing resource.

string resource = Resource.GetCurrentName()


Call

Calls an exported function in the specified resource.

Resource.Call(string resource, string function, list arguments)

Example:

Resource.Call("myResource", "myFunction", { 8, 16 })

Start

Start a resource. The returned Boolean indicates whether the action was successful.

bool success = Resource.Start(string name)


Stop

Stop a resource. The returned Boolean indicates whether the action was successful.

bool success = Resource.Stop(string name)

info

The resource does not stop immediately, but only at the next resource tick.


Restart

Restart a resource. The returned Boolean indicates whether the action was successful.

bool success = Resource.Restart(string name)

info

The resource does not restart immediately, but only at the next resource tick.