util.resource.is_loaded

Shared

Checks whether a resource is loaded


Syntax

local result = util.resource.is_loaded(
    name
)

A loaded resource is not necessarily running.

A resource is considered loaded once its manifest has been parsed and registered. It may not have been started yet.
Use util.resource.is_running to check whether it is actively executing.

Parameters

TypeNameDescription
stringnameName of the resource to check

Returns

TypeNameDescription
boolresulttrue if the resource is loaded, false otherwise

Examples

Check if a resource is loaded
if util.resource.is_loaded("my_resource") then
    core.engine.print("info", "Resource is loaded")
end
Guard a call based on load state
if not util.resource.is_loaded("inventory_resource") then
    core.engine.print("warn", "inventory_resource is not loaded")
    return
end

local items = util.export.call("inventory_resource", "get_items")
core.engine.iprint(items)

On this page