util.export.list
Shared
Retrieves all export names registered by a resource
Syntax
local result = util.export.list(
resource
)The target resource must be running before listing its exports.
Throws an error if the specified resource is not currently running. Use this function to inspect or validate available export before calling them.
Parameters
| Type | Name | Description |
|---|---|---|
string | resource | Name of the resource whose export to list |
Returns
| Type | Name | Description |
|---|---|---|
table | result | Array of export name strings registered by the resource; empty table if none are registered |
Examples
core.engine.iprint(util.export.list("my_resource"))local list = util.export.list("inventory_resource")
local has_export = false
for _, name in ipairs(list) do
if name == "get_items" then
has_export = true
break
end
end
if has_export then
local items = util.export.call("inventory_resource", "get_items", player_id)
core.engine.iprint(items)
else
core.engine.print("warn", "Export 'get_items' not found on inventory_resource")
end