#cp.ids

Allows managing values/IDs which can vary between versions.


#API Overview

Functions - API calls offered directly by the extension

Methods - API calls which can only be made on an object returned by a constructor


#API Documentation

#Functions

Signaturecp.ids.new(path[, currentVersionFn]) -> cp.ids
TypeFunction
DescriptionCreates a new ids instance with the specified path to the version files and a function to find the current version, if appropriate.
Parameters
  • path - The path to the version files.
  • currentVersionFn - An optional function that will return the current version as a string or semver.
Returns
  • A new cp.ids instance.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 41

#Methods

Signaturecp.ids:currentVersion() -> semver
TypeMethod
DescriptionReturns the current version number for the IDs library. May be nil.
Parameters
  • None
Returns
  • A semver with the version number or nil if none is available.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 61

Signaturecp.ids:load([version]) -> table
TypeMethod
DescriptionLoads and caches IDs for the given version. It will search through previous versions, with each subsequent version file overriding the previous version's value, if present.
Parameters
  • version - The version number you want to load as a string (i.e. "10.4.0"). If not provided, the current version is loaded.
Returns
  • A table containing all the IDs
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 135

Signaturecp.ids:of(version, subset) -> function
TypeMethod
DescriptionReturns a function which can be called to retrieve a specific value for the specified version.
Parameters
  • version - The version number you want to load as a string (i.e. "10.4.0")
  • subset - A string containing the subset of data you want to load
Returns
  • A function that will return the value of the specified subset ID for the specified version.
Notes
  • For example:
  • lua</li><li>local id = ids:of("10.4.0", "CommandEditor")</li><li>print "bar = "..id("bar")</li><li>
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 187

Signaturecp.ids:ofCurrent(subset) -> function
TypeMethod
DescriptionReturns a function which can be called with an ID to retrieve a specific value for the current version.
Parameters
  • subset - A string containing the subset of data you want to load
Returns
  • A function that will return the value of the specified subset ID for the current version.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 213

Signaturecp.ids:previousVersion([version]) -> semver
TypeMethod
DescriptionReturns the previous version number that has stored IDs.
Parameters
  • version - The version number you want to load as a string (i.e. "10.4.0") or a semver, or nil to use the current version.
Returns
  • A semver instance for the previous version.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 104

Signaturecp.ids:versions() -> table
TypeMethod
DescriptionReturns a table of versions.
Parameters
  • None
Returns
  • A table of semver objects.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ids/init.lua line 74