util.resource.stop
Server
Stops a running resource
Syntax
local result = util.resource.stop(
name
)The resource must be running before it can be stopped.
- Not running — returns
falseif the resource is not currently running. - Cleanup — stopping a resource cleans up all its entities, threads, promises, timers, events, and exports automatically.
- Async — the stop is enqueued and executes on the next main thread tick; the resource will not be stopped immediately after this call returns.
Parameters
| Type | Name | Description |
|---|---|---|
string | name | Name of the resource to stop |
Returns
| Type | Name | Description |
|---|---|---|
bool | result | true if the stop was enqueued successfully, false otherwise |
Examples
util.resource.stop("my_resource")if util.resource.is_running("my_resource") then
util.resource.stop("my_resource")
end