glob_resource(3)
β¨ glob_resource(3) β¨
okay bestie, this is the Arcan Lua API page for glob_resource, and itβs literally about searching the different datastores for resources that match a pattern. itβs giving βfind my stuff across namespacesβ energy π«Ά
π NAME π
glob_resource β search the different datastores for resources matching a pattern.
π SYNOPSIS π
strtbl or nbio
glob_resource( string:pattern )
glob_resource( string:pattern, int:domain )
glob_resource( string:pattern, int:domain, bool:asynch )
glob_resource( string:pattern, string:namespace )
glob_resource( string:pattern, string:namespace, bool:asynch )
glob_resource( string:pattern, int:domain )
πΈ DESCRIPTION πΈ
so there are a bunch of different statically defined namespaces β think distinct groups where a certain resource key corresponds to a file or similar data-source. this function lets you query parts of those namespaces, and those parts are indicated by a search path, aka the pattern π¦
by specifying a domain, you can limit the search to a specific set of namespaces. that domain can be a predefined bitmap of numeric constants, or a user-defined dynamic namespace tag. valid constants for domain (can be OR-ed) are:
APPL_RESOURCEAPPL_TEMP_RESOURCESHARED_RESOURCESYS_APPL_RESOURCESYS_FONT_RESOURCEAPPL_STATE_RESOURCE
the dynamic namespace tag has to match a valid name from list_namespaces, iykyk π
if the asynch argument is provided, the function will return an nbio table as if opened with open_nonblock, or nil if there are too many open files or not enough memory. the results readable from open_nonblock will contain the terminating in order to capture file names with special characters π they will also contain the namespace relative path prefix.
open_nonblock :lf_strip(true, " ") can be used to get per-read separation and β yep, the sentence literally ends on βandβ in the source, so Iβm leaving it exactly like that π«
π NOTES π
- the default domain is the compile-time defined (
DEFAULT_USERMASK) which is comprised of (application- specific, application shared, application temporary) β¨ - due to legacy and backwards compatibility, the synchronous results contain only filename and, possibly, extension.
SYS_APPL_RESOURCEis special and relates to the list of application targets that can be used as argument tosystem_collapse.
π EXAMPLE π
function glob_resource0()
local tbl = glob_resource("*");
for i,v in ipairs(tbl) do
print(v);
end
end
π¦ EXAMPLE π¦
function glob_resource1()
local tbl = glob_resource("*", SYS_APPL_RESOURCE);
for i,v in ipairs(tbl) do
print(v);
end
end
π MISUSE π
not me passing 0 and then checking if the vibes are table-shaped π this is the misuse example, bestie:
function glob_resource0()
local tbl = glob_resource(0);
if (type(tbl) ~= "table") then
abort();
end
end
π SEE ALSO π
mwah π β this page comes from the resource source, October 2026 version, and itβs literally iconic. glob_resource(3) out, periodt π
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms