Resource
Shared Functions
Name | Description |
---|---|
GetState | Returns the state of the specified resource. |
GetCurrentName | Returns the name of the currently executing resource. |
Call | Calls an exported function in the specified resource. |
Server Functions
Name | Description |
---|---|
Start | Start a resource. |
Stop | Stop a resource. |
Restart | Restart a resource. |
GetState
Returns the state of the specified resource.
string state = Resource.GetState(string resource)
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:
- Lua
- Squirrel
Resource.Call("myResource", "myFunction", { 8, 16 })
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)
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)
The resource does not restart immediately, but only at the next resource tick.