AutoInstall

LuaFAR for Editor

AutoInstall


AutoInstall (startpath, [filepattern], [depth])

Function AutoInstall is available to the _usermenu.lua script.
It looks for files whose names match filepattern in the directory given by startpath and its subdirectories recursively, and calls AddUserFile for each matching file found.

Parameters

  1. startpath (string)
    A path relative to the plugin’s directory

  2. filepattern (string, or nil)
    Lua regular expression specifying what files to install. Only file name (without path) is matched against this regular expression. If the parameter is not specified, the value "^_usermenu%.lua$" is used.

  3. depth (number, or nil)
    The maximum depth of subdirectories to recurse into. When it is 0, the search is conducted only in startpath. When it is not specified, the recursion depth is unlimited.

Warning

This function should be used with caution since it runs every matching file found.

Examples

  AutoInstall ("scripts")
  AutoInstall ("scripts", nil, 1)
  AutoInstall ("scripts/cool", "^_.*menu%.lua$", 0)