Module luarocks.search
Module implementing the LuaRocks "search" command. Queries LuaRocks repositories.
Functions
| disk_search (repo, query, results) | Perform search on a local repository. |
| find_suitable_rock (query) | Attempt to get a single URL for a given search. |
| make_query (name, version) | Prepare a query in dependency table format. |
| manifest_search (results, repo, query) | Perform search on a remote repository. |
| print_results (results, show_repo) | Print a list of rocks/rockspecs on standard output. |
| run (name, version) | Driver function for "search" command. |
Functions
- disk_search (repo, query, results)
-
Perform search on a local repository.
Parameters
- repo: string: The pathname of the local repository.
- query: table: A table describing the query in dependency format (for example, {name = "filesystem", exact_name = false, constraints = {op = "~>", version = {1,0}}}, arch = "rockspec"). If the arch field is omitted, the local architecture (config.arch) is used. The special value "any" is also recognized, returning all matches regardless of architecture.
- results: table or nil: If given, this table will store the results; if not given, a new table will be created.
- find_suitable_rock (query)
-
Attempt to get a single URL for a given search.
Parameters
- query: table: A dependency query.
Return value:
string or table or (nil, string): URL for matching rock if a single one was found, a table of candidates if it could not narrow to a single result, or nil followed by an error message. - make_query (name, version)
-
Prepare a query in dependency table format.
Parameters
- name: string: The query name.
- version: string or nil:
Return value:
table: A query in table format - manifest_search (results, repo, query)
-
Perform search on a remote repository.
Parameters
- results: table: The results table, where keys are package names and versions are tables matching version strings to an array of repositories.
- repo: string: The URL of the remote repository.
- query: table: A table describing the query in dependency format (for example, {name = "filesystem", exact_name = false, constraints = {op = "~>", version = {1,0}}}, arch = "rockspec"). If the arch field is omitted, the local architecture (config.arch) is used. The special value "any" is also recognized, returning all matches regardless of architecture.
Return value:
boolean or nil, string: true if no errors ocurred; or nil followed by an error message. - print_results (results, show_repo)
-
Print a list of rocks/rockspecs on standard output.
Parameters
- results: table: A table where keys are package names and versions are tables matching version strings to an array of repositories.
- show_repo: boolean or nil: Whether to show repository information or not. Default is true.
- run (name, version)
-
Driver function for "search" command.
Parameters
- name: string: A substring of a rock name to search.
- version: string or nil: a version may also be passed.
Return value:
boolean or (nil, string): True if build was successful; nil and an error message otherwise.