Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
glob_resource(3)		 Arcan Lua API		      glob_resource(3)

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
       There are a number of different statically defined namespaces (distinct
       group where a certain resource key corresponds to  a  file  or  similar
       data-source).  This  function  allows you to query parts	of these name-
       spaces (indicated by a search path, pattern ). By specifying a domain
       you  can	 limit the search to a specific	set of namespaces. This	domain
       can be a	predefined bitmap of numeric constants,	or a user-defined  dy-
       namic  namespace	 tag.  Valid  constants	 for domain (can be OR ed) are
       APPL_RESOURCE , APPL_TEMP_RESOURCE  ,  SHARED_RESOURCE  ,  SYS_APPL_RE-
       SOURCE  ,  SYS_FONT_RESOURCE  , APPL_STATE_RESOURCE , The dynamic name-
       space tag has to	match a	valid  name  from  list_namespaces  .  If  the
       *asynch"	argument is provided, the function will	return a 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 con-
       tain 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  separa-
       tion and

NOTES
       1      the  default  domain is the compile-time defined ( DEFAULT_USER-
	      MASK ) which is comprised	of (application- specific, application
	      shared, application temporary)

       2      Due to legacy and	backwards compatibility, the  synchronous  re-
	      sults contain only filename and, possibly, extension.

       3

	      SYS_APPL_RESOURCE	  is special and relates to the	list of	appli-
	      cation targets that can be used as argument to system_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
       function	glob_resource0()
	     local tbl = glob_resource(0);
	     if	(type(tbl) ~= "table") then
		   abort();
	     end
       end

SEE ALSO:
       resource(3) system_collapse(3)

resource			  April	2025		      glob_resource(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=glob_resource&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help