Skip to content
mba105 edited this page Sep 24, 2014 · 2 revisions

Home > [Scripting Reference](Scripting Reference) > os.pathsearch


os.pathsearch

The os.pathsearch function searches a collection of paths for a particular file.

#!lua
p = os.pathsearch("fname", "path1", ...)

Parameters

fname is the name of the file being searched. This is followed by one or more path sets to be searched.

Path sets match the format of the PATH environment variable: a colon-delimited list of paths. On Windows, you may use a semicolon-delimited list if drive letters might be included.

Return Value

The path to the directory which contains the file, if found. Otherwise, nil.

Examples

#!lua
local p = os.pathsearch("mysystem.config", "./config:/usr/local/etc:/etc")
Clone this wiki locally