API:GetCreditsData
From RoR Wiki
UI Lua API · Pregame functions
Version: WAR 1.4.8
Returns the game credits as nested tables of sections, subsections and people.
creditsData = GetCreditsData()
Arguments
None.
Returns
- creditsData
table– A table with one field,sections.
| Key | Type | Meaning |
|---|---|---|
sections |
table |
Array of section tables, indexed from 1. |
Each section table:
| Key | Type | Meaning |
|---|---|---|
name |
wstring |
Section title. |
subsections |
table |
Array of subsection tables, indexed from 1. |
Each subsection table:
| Key | Type | Meaning |
|---|---|---|
name |
wstring |
Subsection title. L"" when the CSV gives no string id.
|
desc |
wstring |
Subsection description. L"" when the CSV gives no string id.
|
people |
table |
Array of person tables, indexed from 1. |
Each person table:
| Key | Type | Meaning |
|---|---|---|
name |
wstring |
The person's name. |
title |
wstring |
The person's job title. Only present when the subsection's title string file could be loaded. |
Details
- The structure comes from
interfacecore/credits/sections.csvandinterfacecore/credits/subsections.csv. Each subsections row names a section, string ids for its name and description, a names file, a titles file and the number of people. - The texts are loaded from the client's credits string files for the current language. The string tables are loaded for the call and unloaded again afterwards.
- The whole table is built from the files on every call.
Errors
None.
Example
From interfacecore/source/creditswindow.lua:
local creditsData = GetCreditsData()
for sectionIndex, sectionData in ipairs( creditsData.sections )
do
LabelSetText( sectionWindowName, wstring.upper( sectionData.name ) )
for subSectionIndex, subSectionData in ipairs( sectionData.subsections )
do
local namesText = L""
local titlesText = L""
for _, personData in ipairs( subSectionData.people )
do
namesText = namesText..L"\n"..personData.name
if( personData.title )
then
titlesText = titlesText..L"\n"..personData.title
end
end
-- ...
(Window creation lines left out.)
