Function; doscanpath - HWRM/KarosGraveyard GitHub Wiki

doscanpath(<directory>, <pattern>)

Similar to dofilepath, but instead takes a directory as its first argument and a pattern to match against the files within that directory. Files matching the pattern are executed the same as dofilepath.

Note that this function does not include directories within the search directory, so is not recursive.

Arguments

Param Type Description
directory string The path of the directory to be searched. Usually a relative path such as "data:my-script.lua". See Tutorial; Relative File Paths
pattern string A regex-like pattern to match filenames. The exact syntax is not fully known, but is probably a Lua pattern.

Example

The wildcard character * means 'any character, any length', and will match any file name.

Therefore, we could load all the lua files in the data:scripts/races/hiigaran/research directory like this:

doscanpath("data:scripts/races/hiigaran/scripts/research", "*.lua");

Related Pages

⚠️ **GitHub.com Fallback** ⚠️