Skip to main content

Resource

Quick Reference

NameTypeDescription
GetStateSharedReturns the state of the specified resource.
GetCurrentNameSharedReturns the name of the currently executing resource.
CallSharedCalls an exported function in the specified resource.
StartServerStart a resource.
StopServerStop a resource.
RestartServerRestart a resource.

Shared Functions

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 })

Server Functions

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.