componentSystemUtil
(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)
Utilities to provide information on component systems in a convenient form.
See documentation for module ComponentSystem. Also see functions related to component systems in vrfutil, in the Util table.
Function List
| makeSystemManifest (categoryName, attributeName) | Creates and returns a manifest of component systems as a lua table. |
| printSystemAtributes (system, ComponentSystem.) | Given a system, retrieve and print attributes |
| printSystemManifest (manifest) | Prints the contents of a manifest generated from makeSystemManifest |
| systemsForCategory (manifest, category, breakAfterFirst) | Searches the given system manifest for ones matching category (substring search) Optionally, break after first return empty list or list of found entries category can be a partial string, e.g. |
Functions
- makeSystemManifest (categoryName, attributeName)
-
Creates and returns a manifest of component systems as a lua table. Walks through the component systems of "this". If categoryName appears in the full name of a system, make an entry in a manifest. Optionally, search for an attribute with name attributeName in the found system The entry will also contain an attribute of attributeName if it is found in the system. See this:getSystemAttribute() for more information about types of attributes. Return a table in the form of {{name=
,longname= ,category= ,attribute= },...} {{ , , , },...} Parameters:
-
categoryName: String. Substring to search for in the full name of the system, e.g. "weapon" -
attributeName: String. (optional) An attribute of the system to return.
Return value:
- Table. {{name=
,longname= ,category= ,attribute= },...} -
- printSystemAtributes (system, ComponentSystem.)
-
Given a system, retrieve and print attributes
Parameters:
-
system: -
ComponentSystem.: Something returned from this:getSystem()
-
- printSystemManifest (manifest)
-
Prints the contents of a manifest generated from makeSystemManifest
Parameters:
-
manifest: Table. In the form described for makeSystemManifest()
-
- systemsForCategory (manifest, category, breakAfterFirst)
-
Searches the given system manifest for ones matching category (substring search) Optionally, break after first return empty list or list of found entries category can be a partial string, e.g. "main" for "main-gun" or "gun-main" case-insensitive search also does reverse: find substring entry.category in category
Parameters:
-
manifest: Table. In the form described under makeSystemManifest. -
category: String. e.g. "weapon" or "main" or "main-gun", can be a substring of the target. -
breakAfterFirst: Boolean. If true, breaks after first match.
Return value:
- Table. This will be a table of manifest entries that match the search.
-
