Module ProjectManager

Provides methods that allow to create and otherwise work with BETS projects.

There are two location in which projects can exist:

  • LuaUI/BETS/Projects
  • LuaUI/Widgets/BtProjects - for internal purposes

Project can also exist in two forms, a directory or an archive containing the SpringData directory structure.

Functions

ProjectManager.archivate (projectName) Produces an archive out of a project with the given name.
ProjectManager.asQualifiedName (projectName, name) Forms a qualified name out of the project name and content name.
ProjectManager.createProject (projectName) Creates a new project.
ProjectManager.findFile (contentType, qualifiedName[, name]) Locates the position of a file based on its type and name.
ProjectManager.fromQualifiedName (qualifiedName) Parse the given qualified name and outputs project and content names.
ProjectManager.getProjects () Returns a list of all projects.
ProjectManager.isProject (projectName) Checks whether the given value is a name of a loaded project.
ProjectManager.listAll (contentType) Lists all files in all loaded projects of the specific ContentType.
ProjectManager.listProject (projectName, contentType) Lists all files in a project of the specific ContentType.
ProjectManager.load () Loads all project information from disk.
ProjectManager.makeRegularContentType (subdirectory, extension) Creates a content type using the specified directory name and extension.
ProjectManager.reload () Reloads the list of projects.
ProjectManager.unload () Unloads all projects.

Class ContentType

ContentType Specifies where content can be found inside the project directory.


Functions

ProjectManager.archivate (projectName)
Produces an archive out of a project with the given name. The archive can then be e.g. send to other users of BETS.

Parameters:

  • projectName string Name of the project to produce the archive from.

Returns:

    true if successful, false otherwise
ProjectManager.asQualifiedName (projectName, name)
Forms a qualified name out of the project name and content name.

Parameters:

  • projectName string Project name.
  • name string Content name.

Returns:

    string Qualified name, as in <project>.<name>.
ProjectManager.createProject (projectName)
Creates a new project. Fails if a project with the same name already exists.

Parameters:

  • projectName string The name of the new project.

Returns:

    true
ProjectManager.findFile (contentType, qualifiedName[, name])
Locates the position of a file based on its type and name. The file doesn't necesarily need to exist, thus allowing to use this method even when finding where to store a file.

Parameters:

  • contentType ContentType
  • qualifiedName string Full qualified name or only a name of a project, with name specified by parameter name.
  • name string The name of the content. (optional)

Returns:

  1. string Path to the file.
  2. tab Parameters of the file, such as project name, content name, whether the file exists and whether the project is readonly.
ProjectManager.fromQualifiedName (qualifiedName)
Parse the given qualified name and outputs project and content names.

Parameters:

  • qualifiedName string Qualified name.

Returns:

  1. string Project name.
  2. string Content name.

Or

    nil, if the given name is not a valid qualifiedName
ProjectManager.getProjects ()
Returns a list of all projects.

Returns:

    {tab} List of project paramters, such as their name, their path and whether the specific project isArchive
ProjectManager.isProject (projectName)
Checks whether the given value is a name of a loaded project.

Parameters:

  • projectName string The name of the project to be checked.
ProjectManager.listAll (contentType)
Lists all files in all loaded projects of the specific ContentType.

Parameters:

Returns:

    {tab} List of table describing the parameters of the files, such as their name and path.
ProjectManager.listProject (projectName, contentType)
Lists all files in a project of the specific ContentType.

Parameters:

Returns:

    {tab} List of table describing the parameters of the files, such as their name and path.
ProjectManager.load ()
Loads all project information from disk.
ProjectManager.makeRegularContentType (subdirectory, extension)
Creates a content type using the specified directory name and extension.

Parameters:

  • subdirectory string The directory name in which the content exists within a project.
  • extension string Extension that is used for the file of that content.

Returns:

    ContentType
ProjectManager.reload ()
Reloads the list of projects.
ProjectManager.unload ()
Unloads all projects.

Remarks:

    Useful when working with archives, that you would like to manipule on the drive, but they are locked. Calling this should load to their unlocking (except it doesn't, because unmapping archives doesn't actually work in SpringRTS).

Class ContentType

ContentType
Specifies where content can be found inside the project directory.

Fields:

  • directoryName string In what directory is the content.
  • fileMask string What filter should be used to find the list of files of that content.
  • nameToFile func Transformation from name of the content to filename.
  • fileToName func Transofmration from filename to the name of the content.
generated by LDoc 1.4.3 Last updated 2017-06-01 23:07:48