GetResourceFiles
List all Lua files within a resource by name.
Syntax
Susano.GetResourceFiles(resourceName) -> table
Parameters
resourceName (string): The name of the resource to list files for.
Return(s)
table: An array of relative file path strings (Lua files only) within the resource.
Behavior
Recursively scans the resource's file tree and returns all .lua files with their relative paths.
Paths use forward slashes (e.g. "client/main.lua", "shared/config.lua").
Useful for discovering which scripts a resource contains before injecting code, or for targeting a specific file via Susano.InjectResource()'s chunkName parameter.
Example(s)
-- List all Lua files in es_extended
local files = Susano.GetResourceFiles("es_extended")
for i, path in ipairs(files) do
print(path)
end
-- Example output:
-- client/main.lua
-- client/modules/actions.lua
-- shared/config.lua
-- Use with InjectResource to target a specific file
local files = Susano.GetResourceFiles("myresource")
for _, f in ipairs(files) do
if f:find("client") then
Susano.InjectResource("myresource", code, 1, "@myresource/" .. f)
break
end
end