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
| Type | Name | Description |
|---|---|---|
string | name | Name of the resource to check |
Returns
| Type | Name | Description |
|---|---|---|
bool | result | true if the resource is loaded, false otherwise |
Examples
if util.resource.is_loaded("my_resource") then
core.engine.print("info", "Resource is loaded")
endif 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)