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 false if 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

TypeNameDescription
stringnameName of the resource to stop

Returns

TypeNameDescription
boolresulttrue if the stop was enqueued successfully, false otherwise

Examples

Stop a resource
util.resource.stop("my_resource")
Guard stop with a running check
if util.resource.is_running("my_resource") then
    util.resource.stop("my_resource")
end

On this page