util.resource.restart

Server

Restarts a running resource


Syntax

local result = util.resource.restart(
    name
)

The resource must be running before it can be restarted.

  • Not running — returns false if the resource is not currently running.
  • Manifest reload — the manifest is re-read and re-parsed on restart; any changes to scripts or files are picked up automatically.
  • Cleanup — the stop phase cleans up all entities, threads, promises, timers, events, and exports before the resource is started again.
  • Async — the restart is enqueued; stop executes immediately on the main thread, then start is re-enqueued after.

Parameters

TypeNameDescription
stringnameName of the resource to restart

Returns

TypeNameDescription
boolresulttrue if the restart was enqueued successfully, false otherwise

Examples

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

On this page