Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

References

Methods to follow references between tables, and between tables and Loc files.

references.definition

Finds the row where a value of a referenced table is defined.

Searches the open packs, then the parent packs, the game files and the Assembly Kit tables, and returns the first row found.

Params (FindDefinition)

NameTypeRequiredDescription
table_namestringyesReferenced table, like factions_tables.
columnstringyesReferenced column. If it’s a localised column, the table’s key is searched instead.
valuestringyesValue to find.
packstring or nullnoIf set, only this open pack is searched, instead of all of them and the dependencies.

Result (FoundRow)

NameTypeRequiredDescription
valuesmap of anyyesValues of the row, by column name.
column_indexintegeryesIndex of the column the value is in.
pathstringyesPath of the table in its source.
row_indexintegeryesIndex of the row.
sourceFileSourceyesWhere the table is.

references.usages

Finds the rows of other tables referencing a value of a table.

The referencing columns are taken from the schema. Searches the open packs, the parent packs and the game files.

Params (FindUsages)

NameTypeRequiredDescription
table_namestringyesTable the value is from, like factions_tables.
columnstringyesColumn the value is from, like key.
valuestringyesValue to find usages of.
versioninteger or nullnoVersion of the table’s definition, to know which columns reference it. Defaults to the version in the game files, or the newest one.
packstring or nullnoIf set, only this open pack is searched, instead of all of them and the dependencies.
offsetintegerno, default 0Amount of usages to skip.
limitinteger or nullnoMaximum amount of usages to return. Defaults to 200.

Result (Usages)

NameTypeRequiredDescription
usagesarray of UsageyesThe usages in the page.
totalintegeryesAmount of usages, in all pages.

references.loc

Finds the row of a Loc file with a key.

Searches the open packs, then the parent packs and the game files, and returns the first row found.

Params (FindLoc)

NameTypeRequiredDescription
keystringyesKey to find, like factions_screen_name_wh_main_emp_empire.
packstring or nullnoIf set, only this open pack is searched, instead of all of them and the dependencies.

Result (FoundRow)

NameTypeRequiredDescription
valuesmap of anyyesValues of the row, by column name.
column_indexintegeryesIndex of the column the value is in.
pathstringyesPath of the table in its source.
row_indexintegeryesIndex of the row.
sourceFileSourceyesWhere the table is.

references.loc_source

Returns the table, column and row a loc key belongs to.

Params (GetLocSource)

NameTypeRequiredDescription
keystringyesThe loc key, like factions_screen_name_wh_main_emp_empire.

Result (LocSourceLookup)

NameTypeRequiredDescription
sourceLocSource or nullyesTable, column and row the key belongs to, if they were found.

references.row_locs

Returns the loc entries of a row of a DB table: the loc key of each of its localised columns, with its text.

Params (GetRowLocs)

NameTypeRequiredDescription
rowRowRefyesThe row.

Result (RowLocs)

NameTypeRequiredDescription
locsarray of RowLocyesThe loc entry of each localised column of the row.

references.table_data

Returns the values each column of a table can reference, with their lookups.

Meant for clients editing whole tables, to fill their dropdowns. Others should use references.values.

Params (GetTableReferenceData)

NameTypeRequiredDescription
table_namestringyesName of the table, like units_tables.
versionintegeryesVersion of the table’s definition.
regeneratebooleanno, default falseIf the references to the tables of the open packs are generated again, instead of reusing the cached ones.

Result (TableReferenceData)

NameTypeRequiredDescription
columnsmap of anyyesReferenceable values, by column index.

references.values

Returns the values a reference column of a table can have, with their display text.

The values come from the referenced column, in the open packs and the dependencies.

Params (GetReferenceValues)

NameTypeRequiredDescription
table_namestringyesName of the table with the reference column, like units_tables.
columnstringyesName of the reference column.
prefixstringno, default ""Only values starting with this are returned.
offsetintegerno, default 0Amount of values to skip.
limitinteger or nullnoMaximum amount of values to return. Defaults to 500.

Result (ReferenceValues)

NameTypeRequiredDescription
valuesarray of ReferenceValueyesThe values in the page, sorted.
totalintegeryesAmount of values matching the request, in all pages.

Types

Type FileSource

Where a file is.

One of:

  • { "pack": … }: An open pack, by key.
    • pack (string, yes)
  • "game_files": The vanilla files of the selected game.
  • "parent_files": The files of the parent packs of the open packs.
  • "assembly_kit": The tables of the selected game’s Assembly Kit. Their paths are db/<table_name>/ak_data.

Type LocSource

Table, column and row a loc key belongs to.

NameTypeRequiredDescription
table_namestringyesName of the table, like factions_tables.
columnstringyesName of the localised column.
key_valuesarray of stringyesValues of the key columns of the row.

Type ReferenceValue

A value a reference column can have.

NameTypeRequiredDescription
valuestringyesThe value.
lookupstringnoText shown next to the value, like the name of the referenced row. Empty if there’s none.

Type RowLoc

The loc entry of a localised column of a row.

NameTypeRequiredDescription
columnstringyesName of the localised column, like onscreen_name.
keystringyesLoc key of the column, like land_units_onscreen_name_my_unit.
textstring or nullyesText of the loc key, from the open packs or the dependencies, or null if there is none.

Type RowRef

A row of a table, in any source.

NameTypeRequiredDescription
fileFileRefyesThe table.
indexintegeryesIndex of the row in the table.

Type FileRef

A file in one of the sources.

NameTypeRequiredDescription
sourceFileSourceyesWhere the file is.
pathstringyesPath of the file in its source.

Type Usage

A row referencing a value.

NameTypeRequiredDescription
columnstringyesName of the column referencing the value.
valuesmap of anyyesValues of the row, by column name.
column_indexintegeryesIndex of the column the value is in.
pathstringyesPath of the table in its source.
row_indexintegeryesIndex of the row.
sourceFileSourceyesWhere the table is.