Skip to content

modhub

Source: api/tealdef/api/type/modhub.d.tl

Contains all type definitions for the modhub.

Globals

Types

Name Definition Description
Mod declared here, defined in Mod Forward declaration of the Mod record, which is defined in api/type/mod.d.tl.

Modhub

record global api/tealdef/api/type/modhub.d.tl:9

global record Modhub

Access: api.type.modhub

modhub types

Types

Name Definition Description
BackendId integer Integer handle of a modhub backend (e.g. mod.io or the local staging area). List them with api.modhub.getBackendIDs().

Modhub.ModValidatorMessage

record api/tealdef/api/type/modhub.d.tl:11

record ModValidatorMessage

Access: api.type.modhub.ModValidatorMessage

Message from mod validator

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:4300

messages : {Modhub.ModValidatorMessage}

Fields

Name Type Description
context string The context of the message, e.g. which check produced it
file string The file path where the issue was found
level LogLevel The severity level of the message
message string The validation message
consoleOnly boolean Whether this issue only affects console platforms

Modhub.ModValidatorResult

record api/tealdef/api/type/modhub.d.tl:25

record ModValidatorResult

Access: api.type.modhub.ModValidatorResult

Result from mod validation

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:4294

result : Modhub.ModValidatorResult

Fields

Name Type Description
messages {ModValidatorMessage} List of validation messages
criticalPc boolean Whether the validation found critical issues on PC
criticalConsole boolean Whether the validation found critical issues on console
cookedPcPath string Cooked PC Path
cookedConsolePath string Cooked Console Path
levelPc LogLevel Minimum log level found on PC
levelConsole LogLevel Minimum log level found on console

Modhub.ModHubErrorCode

record api/tealdef/api/type/modhub.d.tl:42

record ModHubErrorCode

Access: api.type.modhub.ModHubErrorCode

Notes

Error returned by a failed modhub request, e.g. from Modhub.AsyncResult.getError.

Details

The base mod manager shows fields["error_message"] to the user when it is set; otherwise it shows message and code only in debug mode and a generic network error with the code.

Used in the base game: 11 times in 2 files

base/content/gui/gui/menu/mod_manager_react_util.tl:95

mod_manager_react_util.makeErrorMessage = function(err : Modhub.ModHubErrorCode) : string
base/content/gui/gui/menu/mod_selector_page.tl:26
showError: function(string, ?Modhub.ModHubErrorCode)

Fields

Name Type Description
code integer Error Code Number
message string Error Message (not localized, for debug purposes only)
fields {string : string} Additional fields with more information about the error

Modhub.SortType

record api/tealdef/api/type/modhub.d.tl:51

record SortType

Access: api.type.modhub.SortType

Notes

Sort orders for mod lists in the mod browser. Values are accessed as api.type.modhub.SortType.<Name>.

Used in the base game: 3 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:689

onValueChange = function(value : Modhub.SortType)

Fields

Name Type Description
Trending SortType Sort by trend; the mod tiles then show the subscriber count. used 2× in the base game
Rating SortType Sort by rating; the mod tiles then show the rating as a percentage. used 2× in the base game
SubscriberCount SortType Sort by number of subscribers. used 2× in the base game
DateAdded SortType Sort by publication date (ModInfo.publishedUnixTimestamp). used 3× in the base game
DateUpdated SortType Sort by last update (ModInfo.updatedUnixTimestamp). used 2× in the base game
Name SortType Sort by mod name. used 1× in the base game
Source SortType Sort by mod source (ModInfo.modSource). used 2× in the base game
Custom SortType Custom order supplied by the caller; the mod selector uses it for the activation order of the active mods (shown as "Activation Order"). used 2× in the base game

Modhub.SortOrder

record api/tealdef/api/type/modhub.d.tl:63

record SortOrder

Access: api.type.modhub.SortOrder

Notes

One sort option offered by a backend, part of Modhub.SortAndFilterOptions.sortOrders.

Fields

Name Type Description
sortType SortType The sort type of this option.
allowAscDesc boolean Whether this sort option can be used in both ascending and descending order.

Modhub.TagGroup

record api/tealdef/api/type/modhub.d.tl:68

record TagGroup

Access: api.type.modhub.TagGroup

Notes

A group of filter tags offered by a backend (shown as one collapsible checkbox list in the mod filter menu).

Fields

Name Type Description
name string Name of the tag group; the GUI translates it with app.getModTagTranslation.
values {string} Tags in this group; each one can be toggled as a filter.
allowMultipleSelection boolean Whether more than one tag of this group can be selected at once.
noSortTag boolean
visible boolean Whether the group is shown in the filter menu.

Modhub.SortAndFilterOptions

record api/tealdef/api/type/modhub.d.tl:76

record SortAndFilterOptions

Access: api.type.modhub.SortAndFilterOptions

Notes

Sort and filter options of a backend or data provider. Get them with api.modhub.getSortAndFilterOptions(backendId) or provider:getSortAndFilterOptions().

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:4643

local makeStatusComboBox = function(sortAndFilterOptions : Modhub.SortAndFilterOptions) : TreeNodeId

Fields

Name Type Description
tagGroups {TagGroup} Filter tag groups.
sortOrders {SortOrder} Available sort options, used to fill the sort combo box.
statusTagGroupIndex integer 1-based index into tagGroups of the group shown as the status combo box; the GUI ignores it when it is nil or larger than the number of groups.

Modhub.UserInfo

record api/tealdef/api/type/modhub.d.tl:82

record UserInfo

Access: api.type.modhub.UserInfo

Notes

The user logged in to a backend; api.modhub.getUserInfo(backendId) returns nil when nobody is logged in.

Used in the base game: 3 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1195

local makeUserState = function() : Modhub.UserInfo

Fields

Name Type Description
userName string User name of the account.
profileUrl string URL of the user's profile page.
displayName string Display name of the user, shown in the account menu.

Modhub.ModId

record api/tealdef/api/type/modhub.d.tl:88

record ModId

Access: api.type.modhub.ModId

Notes

Identifier of a mod in a modhub backend (e.g. a mod.io mod or a staging-area mod). Not the same as Mod.ModId; convert with api.modhub.getModHubModIdForModId.

Used in the base game: 17 times in 3 files

base/content/gui/gui/menu/mod_manager_page.tl:17

detailMod: Modhub.ModId
base/content/gui/gui/menu/mod_manager_react_util.tl:569
currentModId : Modhub.ModId
base/content/gui/gui/menu/mod_selector_page.tl:74
local makeModHubId = function(mod : string) : Modhub.ModId

Fields

Name Type Description
value string The id as a string.

Functions

new() : ModId api/tealdef/api/type/modhub.d.tl:89

Call as api.type.modhub.ModId.new(…)

Notes

Creates a new, empty ModId.

Returns ModId

Used in the base game: 3 times in 3 files

base/content/gui/gui/menu/mod_manager_page.tl:131

local modId = api.type.modhub.ModId.new()
base/content/gui/gui/menu/mod_manager_react_util.tl:5581
local modhubId : Modhub.ModId = api.type.modhub.ModId.new()
base/content/gui/gui/menu/mod_selector_page.tl:75
local modId = api.type.modhub.ModId.new()

clone(ModId) : ModId api/tealdef/api/type/modhub.d.tl:90

Call as api.type.modhub.ModId.clone(…)

Notes

Returns a copy of the id.

Parameter Type Description
#1 ModId The id to copy.

Returns ModId

isValid(ModId) : boolean api/tealdef/api/type/modhub.d.tl:91

Call as modId:isValid(…) (method)

Notes

Returns whether the id refers to a mod (e.g. a staging mod that was already published has a valid StagingModData.modhubId).

Returns boolean

Used in the base game: 3 times in 2 files

base/content/gui/gui/menu/mod_manager_react_util.tl:3996

if modhubId:isValid() then
base/content/gui/gui/menu/mod_selector_page.tl:1161
if modHubId:isValid() then

Modhub.UserId

record api/tealdef/api/type/modhub.d.tl:95

record UserId

Access: api.type.modhub.UserId

Notes

Identifier of a user in a modhub backend, e.g. the author of a mod (ModDetailsData.userId).

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_page.tl:31

local detailsBack = function(searchUserId? : Modhub.UserId, authorName? : string)

Fields

Name Type Description
value integer Numeric user id.

Functions

new(value? : integer) : UserId api/tealdef/api/type/modhub.d.tl:96

Call as api.type.modhub.UserId.new(…)

Notes

Creates a user id. Without a value the id is invalid, which the mod manager uses to clear an author search (provider:setSearchUserId(api.type.modhub.UserId.new())).

Parameter Type Description
value? integer Numeric user id.

Returns UserId

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_page.tl:42

dataProvider:get():setSearchUserId(api.type.modhub.UserId.new())

equals(UserId, UserId) : boolean api/tealdef/api/type/modhub.d.tl:97

Call as api.type.modhub.UserId.equals(…)

Notes

Returns true when both UserId values are equal.

Returns boolean

isValid(UserId) : boolean api/tealdef/api/type/modhub.d.tl:98

Call as api.type.modhub.UserId.isValid(…)

Notes

Returns whether the id refers to a user.

Returns boolean

Modhub.ModManagementMode

record api/tealdef/api/type/modhub.d.tl:103

record ModManagementMode

Access: api.type.modhub.ModManagementMode

Notes

How much mod management (downloads, installs) a backend may do; set with api.modhub.setModManagementMode(backendId, mode).

Details

The main menu sets Full on the main, mod manager, settings and similar pages, Restricted on the new game, load game and campaign pages (or Disabled if the backend's Capabilities.allowRestrictedMode is false), and Disabled when the menu closes. Leaving Full while downloads are running warns that unfinished downloads will be cancelled.

Used in the base game: 3 times in 2 files

base/content/gui/gui/main/pause_menu.tl:280

local function setModManagementMode(mode : Modhub.ModManagementMode)
base/content/gui/gui/menu/main_menu.tl:539
local function setModManagementMode(mode : Modhub.ModManagementMode)

Fields

Name Type Description
Disabled ModManagementMode No mod management; unfinished downloads are cancelled. used 8× in the base game
Restricted ModManagementMode Limited mod management while setting up or loading a game; mods that are still downloading will not be available. used 8× in the base game
Full ModManagementMode Full mod management, used outside a game. used 8× in the base game

Modhub.InstallState

record api/tealdef/api/type/modhub.d.tl:109

record InstallState

Access: api.type.modhub.InstallState

Notes

Install state of a subscribed mod, from api.modhub.getModInstallState(backendId, modId).

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:40

local function installStateToButtonData(installState : Modhub.InstallState) : {string, string}

Fields

Name Type Description
None InstallState No install state. used 1× in the base game
Downloading InstallState used 1× in the base game
UpdatePending InstallState used 1× in the base game
Installed InstallState used 2× in the base game
DownloadPending InstallState used 1× in the base game
InstallationPending InstallState used 1× in the base game
UninstallPending InstallState used 2× in the base game
Extracting InstallState used 2× in the base game
InsufficientSpace InstallState Installation failed because there is not enough storage space. used 2× in the base game
MiscError InstallState Installation failed with a file system error. used 1× in the base game

Modhub.ModInstallInfo

record api/tealdef/api/type/modhub.d.tl:122

record ModInstallInfo

Access: api.type.modhub.ModInstallInfo

Notes

Where and in which revision an installed mod lies, from api.modhub.getModInstallInfo(backendId, modId).

Fields

Name Type Description
installPath string Folder the mod is installed in.
runtimeRevision integer

Modhub.ModReleaseInfo

record api/tealdef/api/type/modhub.d.tl:127

record ModReleaseInfo

Access: api.type.modhub.ModReleaseInfo

Notes

Information about the current release of a mod (ModInfo.releaseInfo).

Fields

Name Type Description
version string Version string of the release.
releaseNotes string Release notes (change log) of the release.
releaseUnixTimestamp integer Release date as a Unix timestamp.

Modhub.ModInfo

record api/tealdef/api/type/modhub.d.tl:133

record ModInfo

Access: api.type.modhub.ModInfo

Notes

Summary of a mod as listed by a backend: title, texts, statistics, tags. Used for mod tiles and the mod detail page.

Used in the base game: 4 times in 1 file

base/content/gui/gui/menu/mod_selector_page.tl:20

configureMod : function(modName : string, modInfo : Modhub.ModInfo, isCurated : boolean)

Fields

Name Type Description
modId ModId Id of the mod in the backend.
modSource string Origin of the mod, e.g. "StagingArea", "BuiltInMods", "DLC" or the name of a modhub backend such as "mod.io" (see Modhub.Description.name).
visible boolean Whether the mod is public in the backend; publishing uses it as the default for PublishSettings.setPublic.
numDownloads integer Number of downloads.
numSubscribers integer Number of subscribers.
title string Title of the mod.
url string URL of the mod's web page.
summary string Short summary text of the mod.
description string Long description as plain text; the GUI prefers descriptionHtml when set.
descriptionHtml string Long description as HTML.
logoImage string Logo image of the mod; an empty string means the mod has no logo.
installSize integer Size of the installed mod in bytes (the GUI formats it with api.util.formatMemory).
likes integer Number of positive ratings.
dislikes integer Number of negative ratings.
rating number Rating as a fraction, shown with api.util.toStringPercent.
tags {string} Tags of the mod (e.g. "Curated"), matched against the filter tags.
hasDependencies boolean Whether the mod depends on other mods; the mod manager then fetches ModDetailsData.dependencies to find missing ones.
publishedUnixTimestamp integer Publication date as a Unix timestamp.
updatedUnixTimestamp integer Date of the last update as a Unix timestamp.
releaseInfo ModReleaseInfo Information about the current release.

Functions

clone(ModInfo) : ModInfo api/tealdef/api/type/modhub.d.tl:134

Call as api.type.modhub.ModInfo.clone(…)

Notes

Returns a copy of the mod info.

Parameter Type Description
#1 ModInfo The mod info to copy.

Returns ModInfo

Modhub.ModMediaType

record api/tealdef/api/type/modhub.d.tl:158

record ModMediaType

Access: api.type.modhub.ModMediaType

Notes

Kind of image requested with Modhub.GetModMediaRequest.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:2460

local adjustImageParams = function(index : integer, modMediaType : api.type.modhub.ModMediaType) : mod_manager_react_util.ModImageParams

Fields

Name Type Description
Logo ModMediaType used 6× in the base game
GalleryThumb180p ModMediaType Gallery image as a small (180p) thumbnail. used 1× in the base game
GalleryThumb720p ModMediaType Gallery image as a 720p thumbnail.
GalleryOriginal ModMediaType Gallery image in original size. used 3× in the base game
AuthorAvatar ModMediaType Avatar image of the mod's author. used 1× in the base game

Modhub.AuthenticationType

record api/tealdef/api/type/modhub.d.tl:166

record AuthenticationType

Access: api.type.modhub.AuthenticationType

Notes

Login methods of a modhub backend, listed in Capabilities.authenticationTypes.

Used in the base game: 7 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:2758

local function authTypeToString(authType : Modhub.AuthenticationType) : string

Fields

Name Type Description
Email AuthenticationType Login with an email address and an auth code sent by mail; the GUI labels it "Mod.io". It does not use the terms-of-use step. used 5× in the base game
Steam AuthenticationType used 3× in the base game
SteamOffline AuthenticationType Steam offline login; the base login dialog shows it disabled. used 3× in the base game
Gog AuthenticationType used 3× in the base game
Epic AuthenticationType used 3× in the base game
XboxLive AuthenticationType used 3× in the base game
PSN AuthenticationType used 3× in the base game
Paradox AuthenticationType Paradox account login, shown as a separate login panel. used 5× in the base game

Modhub.RatingType

record api/tealdef/api/type/modhub.d.tl:177

record RatingType

Access: api.type.modhub.RatingType

Notes

A user's rating of a mod.

Used in the base game: 5 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:989

initialRating :  Modhub.RatingType

Fields

Name Type Description
Neutral RatingType No rating (a like or dislike was withdrawn). used 1× in the base game
Positive RatingType Like. used 5× in the base game
Negative RatingType Dislike. used 3× in the base game

Modhub.ReportType

record api/tealdef/api/type/modhub.d.tl:183

record ReportType

Access: api.type.modhub.ReportType

Notes

Reason for reporting a mod with api.modhub.submitModReportAsync.

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3306

reportType : Modhub.ReportType

Fields

Name Type Description
Generic ReportType used 2× in the base game
DMCA ReportType used 1× in the base game
NotWorking ReportType used 1× in the base game
RudeContent ReportType used 1× in the base game
IllegalContent ReportType used 1× in the base game
StolenContent ReportType used 1× in the base game
FalseInformation ReportType used 1× in the base game
Other ReportType used 1× in the base game

Modhub.StorageInfo

record api/tealdef/api/type/modhub.d.tl:194

record StorageInfo

Access: api.type.modhub.StorageInfo

Notes

Storage used by installed mods, from api.modhub.getStorageInfo(backendId).

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:5119

storageInfo : Modhub.StorageInfo

Fields

Name Type Description
usedSpace integer Used storage in bytes.
totalSpace integer Available storage in bytes; may be nil when there is no limit (the GUI then shows no fill level).

Modhub.ModManagementState

record api/tealdef/api/type/modhub.d.tl:199

record ModManagementState

Access: api.type.modhub.ModManagementState

Notes

Progress of a backend's downloads or uploads, from api.modhub.getModManagementState(backendId).

Fields

Name Type Description
uploading boolean Whether the running operations are uploads (otherwise downloads).
busy boolean Whether downloads or uploads are running.
totalPending integer Total number of mods in the current batch.
pending {ModId} Mods still waiting to be processed.
finished {ModId} Mods already processed in the current batch.
progress number Progress of the current operation, shown in a progress bar.
currentModId ModId Mod being processed right now, or nil.

Modhub.Capabilities

record api/tealdef/api/type/modhub.d.tl:209

record Capabilities

Access: api.type.modhub.Capabilities

Notes

What a backend supports, from api.modhub.getCapabilities(backendId). The GUI shows or hides features based on these flags.

Fields

Name Type Description
allowForceUninstall boolean Whether the force-uninstall button is shown (api.modhub.forceUninstallModAsync).
authenticationTypes {AuthenticationType} Login methods offered; the GUI only shows a login button when the list is not empty.
manualRefresh boolean Whether a manual Refresh button is offered (api.modhub.refreshAsync).
specialModRefresh boolean Whether api.modhub.specialRefreshModAsync is used to retry a mod that failed for lack of space.
allowReport boolean Whether mods can be reported.
isInfoOnly boolean True for a local, information-only backend (such as the staging area) that cannot subscribe or install mods.
allowUnsubscribeInstalledMods boolean Whether installed mods may be unsubscribed.
allowRestrictedMode boolean Whether ModManagementMode.Restricted is allowed; otherwise the main menu uses Disabled instead.
allowModUpload boolean Whether mods (and shared savegames) can be uploaded.
visibleInModHub boolean Whether the backend gets a tab in the mod manager.

Modhub.Description

record api/tealdef/api/type/modhub.d.tl:222

record Description

Access: api.type.modhub.Description

Notes

Name and icon of a backend, from api.modhub.getDescription(backendId).

Fields

Name Type Description
name string Internal name of the backend, e.g. "mod.io"; matches ModInfo.modSource.
nameLocalized string Translated name, used as the tab title.
url string URL of the backend's web site.
icon string Icon image path of the backend.

Modhub.EmailAuthCodeRequest

record api/tealdef/api/type/modhub.d.tl:229

record EmailAuthCodeRequest

Access: api.type.modhub.EmailAuthCodeRequest

Notes

Request for api.modhub.requestEmailAuthCodeAsync: step 1 of the email login, which asks the backend to mail an auth code.

Fields

Name Type Description
email string Email address of the user.

Functions

new(string) : EmailAuthCodeRequest api/tealdef/api/type/modhub.d.tl:230

Call as api.type.modhub.EmailAuthCodeRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 string Email address of the user.

Returns EmailAuthCodeRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:2854

local request = api.type.modhub.EmailAuthCodeRequest.new(localEmail)

Modhub.EmailAuthCodeData

record api/tealdef/api/type/modhub.d.tl:234

record EmailAuthCodeData

Access: api.type.modhub.EmailAuthCodeData

Notes

Result data of api.modhub.requestEmailAuthCodeAsync.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:2855

mod_manager_react_util.setAsyncRef(asyncRef, api.modhub.requestEmailAuthCodeAsync(params.backendId, request, function(result : Modhub.AsyncResult<Modhub.EmailAu

Fields

Name Type Description
response Response Outcome of the request.

Modhub.EmailAuthCodeData.Response

record api/tealdef/api/type/modhub.d.tl:235

record Response

Access: api.type.modhub.EmailAuthCodeData.Response

Notes

Outcome of an auth code request.

Fields

Name Type Description
ValidationError Response The email address was rejected. used 1× in the base game
NeedAuthCode Response A code was sent; continue with api.modhub.authenticateUserEmailAsync. used 1× in the base game
Authenticated Response The user is logged in.

Modhub.AuthenticateUserEmailRequest

record api/tealdef/api/type/modhub.d.tl:243

record AuthenticateUserEmailRequest

Access: api.type.modhub.AuthenticateUserEmailRequest

Notes

Request for api.modhub.authenticateUserEmailAsync: step 2 of the email login, which sends the auth code from the mail.

Fields

Name Type Description
authCode string The auth code from the mail.

Functions

new(string) : AuthenticateUserEmailRequest api/tealdef/api/type/modhub.d.tl:244

Call as api.type.modhub.AuthenticateUserEmailRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 string The auth code.

Returns AuthenticateUserEmailRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:2881

local request = api.type.modhub.AuthenticateUserEmailRequest.new(localAuthCode)

Modhub.AuthenticateUserEmailData

record api/tealdef/api/type/modhub.d.tl:248

record AuthenticateUserEmailData

Access: api.type.modhub.AuthenticateUserEmailData

Notes

Result data of api.modhub.authenticateUserEmailAsync.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:2882

mod_manager_react_util.setAsyncRef(asyncRef, api.modhub.authenticateUserEmailAsync(params.backendId, request, function(result : Modhub.AsyncResult<Modhub.Authen

Fields

Name Type Description
response Response Outcome of the authentication.

Modhub.AuthenticateUserEmailData.Response

record api/tealdef/api/type/modhub.d.tl:249

record Response

Access: api.type.modhub.AuthenticateUserEmailData.Response

Notes

Outcome of an email authentication.

Fields

Name Type Description
ValidationError Response The auth code was rejected. used 1× in the base game
ExpiredAuthCode Response The auth code has expired; a new one must be requested. used 1× in the base game
Authenticated Response The user is logged in.

Modhub.TermsOfUseRequest

record api/tealdef/api/type/modhub.d.tl:257

record TermsOfUseRequest

Access: api.type.modhub.TermsOfUseRequest

Notes

Request for api.modhub.getTermsOfUseAsync, sent before an external (non-email) login.

Fields

Name Type Description
type AuthenticationType Login method the terms are needed for.

Functions

new(AuthenticationType) : TermsOfUseRequest api/tealdef/api/type/modhub.d.tl:258

Call as api.type.modhub.TermsOfUseRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 AuthenticationType Login method the terms are needed for.

Returns TermsOfUseRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3096

local request = api.type.modhub.TermsOfUseRequest.new(authType)

Modhub.TermsOfUseData

record api/tealdef/api/type/modhub.d.tl:262

record TermsOfUseData

Access: api.type.modhub.TermsOfUseData

Notes

Terms of use the user must accept before an external login.

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3046

tocData : Modhub.TermsOfUseData

Fields

Name Type Description
terms string Text of the terms; when nil the GUI logs in without asking.
agreeLabel string Label of the accept button.
disagreeLabel string Label of the decline button.

Modhub.AuthenticateUserExternalRequest

record api/tealdef/api/type/modhub.d.tl:268

record AuthenticateUserExternalRequest

Access: api.type.modhub.AuthenticateUserExternalRequest

Notes

Request for api.modhub.authenticateUserExternalAsync: login through a platform account (Steam, GOG, Epic, console, Paradox).

Fields

Name Type Description
type AuthenticationType Login method.
email string optional

Functions

new(AuthenticationType) : AuthenticateUserExternalRequest api/tealdef/api/type/modhub.d.tl:269

Call as api.type.modhub.AuthenticateUserExternalRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 AuthenticationType Login method.

Returns AuthenticateUserExternalRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3064

local request = api.type.modhub.AuthenticateUserExternalRequest.new(authType)

Modhub.AuthenticateUserExternalData

record api/tealdef/api/type/modhub.d.tl:274

record AuthenticateUserExternalData

Access: api.type.modhub.AuthenticateUserExternalData

Notes

Result data of api.modhub.authenticateUserExternalAsync.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3065

mod_manager_react_util.setAsyncRef(asyncRef, api.modhub.authenticateUserExternalAsync(params.backendId, request, function(result : Modhub.AsyncResult<Modhub.Aut

Fields

Name Type Description
response Response Outcome of the login.

Modhub.AuthenticateUserExternalData.Response

record api/tealdef/api/type/modhub.d.tl:275

record Response

Access: api.type.modhub.AuthenticateUserExternalData.Response

Notes

Outcome of an external login.

Fields

Name Type Description
UnkownError Response
PortalSignInError Response Login through the platform failed; the GUI asks the user to check that they are logged in to the platform. used 1× in the base game
ValidationError Response The login was rejected. used 1× in the base game
Authenticated Response The user is logged in.

Modhub.LogoutData

record api/tealdef/api/type/modhub.d.tl:284

record LogoutData

Access: api.type.modhub.LogoutData

Notes

Result data of api.modhub.logoutAsync (no fields).

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1262

mod_manager_react_util.setAsyncRef(asyncRef, api.modhub.logoutAsync(params.context.backendId, function(result : Modhub.AsyncResult<Modhub.LogoutData>)

Modhub.ListModsRequest

record api/tealdef/api/type/modhub.d.tl:287

record ListModsRequest

Access: api.type.modhub.ListModsRequest

Notes

Request for api.modhub.listModsAsync: one page of a mod search.

Fields

Name Type Description
page integer Page to fetch.
preferedPageSize integer Preferred number of mods per page.
searchString string Search text.
sortType SortType Sort order.
sortAscending boolean Whether to sort ascending.
tags {integer}
fetchLongDescription boolean Whether to include the long description in the results.

Functions

new() : ListModsRequest api/tealdef/api/type/modhub.d.tl:288

Call as api.type.modhub.ListModsRequest.new(…)

Notes

Creates a new, empty ListModsRequest.

Returns ListModsRequest

Modhub.ListModsData

record api/tealdef/api/type/modhub.d.tl:298

record ListModsData

Access: api.type.modhub.ListModsData

Notes

Result data of api.modhub.listModsAsync.

Fields

Name Type Description
modInfos {ModInfo} Mods on the requested page.
modsPerPage integer Number of mods per page.
totalResultCount integer Total number of mods matching the search.

Modhub.GetModDetailsRequest

record api/tealdef/api/type/modhub.d.tl:304

record GetModDetailsRequest

Access: api.type.modhub.GetModDetailsRequest

Notes

Request for api.modhub.getModDetailsAsync.

Fields

Name Type Description
modId ModId Id of the mod.

Functions

new(ModId) : GetModDetailsRequest api/tealdef/api/type/modhub.d.tl:305

Call as api.type.modhub.GetModDetailsRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.

Returns GetModDetailsRequest

Used in the base game: 4 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:715

local request = api.type.modhub.GetModDetailsRequest.new(params.modId)

Modhub.UserPortal

record api/tealdef/api/type/modhub.d.tl:310

record UserPortal

Access: api.type.modhub.UserPortal

Notes

Platform account type of a mod author (ModDetailsData.userPortal).

Fields

Name Type Description
XboxLive UserPortal
PlaystationNetwork UserPortal used 1× in the base game
Misc UserPortal Any other account; the GUI then loads the author avatar from the backend instead of a platform image. used 1× in the base game

Modhub.ModDetailsData

record api/tealdef/api/type/modhub.d.tl:316

record ModDetailsData

Access: api.type.modhub.ModDetailsData

Notes

Full details of a mod, the result data of api.modhub.getModDetailsAsync.

Used in the base game: 6 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:718

function(result : Modhub.AsyncResult<Modhub.ModDetailsData>)

Fields

Name Type Description
modInfo ModInfo Summary information of the mod.
author string Name of the author.
userId UserId User id of the author; the mod manager uses it to list the author's other mods.
userPortal UserPortal Platform account type of the author.
numGalleryImages integer Number of gallery images; fetch them with GetModMediaRequest and indices 0 to numGalleryImages - 1.
logoImage string
galleryImages {string}
dependencies {{ModId, string}} Dependencies of the mod as {modId, name} pairs.
found boolean Whether the mod exists in the backend.

Functions

new() : ModDetailsData api/tealdef/api/type/modhub.d.tl:317

Call as api.type.modhub.ModDetailsData.new(…)

Notes

Creates a new, empty ModDetailsData.

Returns ModDetailsData

Modhub.GetModMediaRequest

record api/tealdef/api/type/modhub.d.tl:330

record GetModMediaRequest

Access: api.type.modhub.GetModMediaRequest

Notes

Request for api.modhub.getModMediaAsync: loads one image of a mod.

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:144

local oldRequest = react.useRef(nil as Modhub.GetModMediaRequest)

Fields

Name Type Description
modId ModId Id of the mod.
type ModMediaType Kind of image.
galleryIndex integer Gallery index (0-based) for gallery images.

Functions

new(ModId, ModMediaType, integer) : GetModMediaRequest api/tealdef/api/type/modhub.d.tl:331

Call as api.type.modhub.GetModMediaRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.
#2 ModMediaType Kind of image.
#3 integer Gallery index (0-based) for gallery images.

Returns GetModMediaRequest

Example

local request = api.type.modhub.GetModMediaRequest.new(modId, api.type.modhub.ModMediaType.GalleryOriginal, 0)
api.modhub.getModMediaAsync(backendId, request, function(result)
  if result:isSuccess() then
    local data = result:getData()
    print(data.width, data.height)
  end
end)
Used in the base game: 7 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:306

request = api.type.modhub.GetModMediaRequest.new(modInfo.modId, api.type.modhub.ModMediaType.Logo, -1)

Modhub.ModMediaData

record api/tealdef/api/type/modhub.d.tl:336

record ModMediaData

Access: api.type.modhub.ModMediaData

Notes

Image data, the result data of api.modhub.getModMediaAsync.

Details

The GUI shows it with builtin.ImageView{ data_native = data.data_native, size = api.type.Vec2i.new(data.width, data.height) }.

Used in the base game: 3 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:145

local oldData = react.useRef(nil as Modhub.ModMediaData)

Fields

Name Type Description
width integer Image width in pixels.
height integer Image height in pixels.
channels integer Number of color channels.
data {integer} Pixel data as a Lua table.
data_native Vector<integer> Pixel data as a native vector, as passed to ImageView.data_native.

Functions

new() : ModMediaData api/tealdef/api/type/modhub.d.tl:337

Call as api.type.modhub.ModMediaData.new(…)

Notes

Creates a new, empty ModMediaData.

Returns ModMediaData

Modhub.GetModRatingRequest

record api/tealdef/api/type/modhub.d.tl:345

record GetModRatingRequest

Access: api.type.modhub.GetModRatingRequest

Notes

Request for api.modhub.getModRatingAsync: the current user's rating of a mod.

Fields

Name Type Description
modId ModId Id of the mod.

Functions

new(ModId) : GetModRatingRequest api/tealdef/api/type/modhub.d.tl:346

Call as api.type.modhub.GetModRatingRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.

Returns GetModRatingRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1036

local request = api.type.modhub.GetModRatingRequest.new(params.modInfo.modId)

Modhub.ModRatingData

record api/tealdef/api/type/modhub.d.tl:350

record ModRatingData

Access: api.type.modhub.ModRatingData

Notes

Result data of api.modhub.getModRatingAsync.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1037

local async = api.modhub.getModRatingAsync(params.context.backendId, request, function(result : Modhub.AsyncResult<Modhub.ModRatingData>)

Fields

Name Type Description
rating RatingType The current user's rating of the mod.

Functions

new() : ModRatingData api/tealdef/api/type/modhub.d.tl:351

Call as api.type.modhub.ModRatingData.new(…)

Notes

Creates a new, empty ModRatingData.

Returns ModRatingData

Modhub.SubscribeModRequest

record api/tealdef/api/type/modhub.d.tl:355

record SubscribeModRequest

Access: api.type.modhub.SubscribeModRequest

Notes

Request for api.modhub.subscribeModAsync.

Fields

Name Type Description
modId ModId Id of the mod to subscribe to.

Functions

new(ModId) : SubscribeModRequest api/tealdef/api/type/modhub.d.tl:356

Call as api.type.modhub.SubscribeModRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.

Returns SubscribeModRequest

Used in the base game: 2 times in 2 files

base/content/gui/gui/menu/mod_manager_react_util.tl:898

async = api.modhub.subscribeModAsync(params.context.backendId, api.type.modhub.SubscribeModRequest.new(params.modId), function(result : Modhub.AsyncResult<Modhu
base/content/gui/gui/menu/mod_selector_page.tl:313
api.type.modhub.SubscribeModRequest.new(makeModHubId(modDesc.modhubModId)),

Modhub.UnsubscribeModRequest

record api/tealdef/api/type/modhub.d.tl:360

record UnsubscribeModRequest

Access: api.type.modhub.UnsubscribeModRequest

Notes

Request for api.modhub.unsubscribeModAsync.

Fields

Name Type Description
modId ModId Id of the mod to unsubscribe from.

Functions

new(ModId) : UnsubscribeModRequest api/tealdef/api/type/modhub.d.tl:361

Call as api.type.modhub.UnsubscribeModRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.

Returns UnsubscribeModRequest

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:837

async = api.modhub.unsubscribeModAsync(params.context.backendId, api.type.modhub.UnsubscribeModRequest.new(params.modId), function(result : Modhub.AsyncResult<M

Modhub.SubscriptionData

record api/tealdef/api/type/modhub.d.tl:365

record SubscriptionData

Access: api.type.modhub.SubscriptionData

Notes

Result data of api.modhub.subscribeModAsync and api.modhub.unsubscribeModAsync (no fields).

Used in the base game: 4 times in 2 files

base/content/gui/gui/menu/mod_manager_react_util.tl:837

async = api.modhub.unsubscribeModAsync(params.context.backendId, api.type.modhub.UnsubscribeModRequest.new(params.modId), function(result : Modhub.AsyncResult<M
base/content/gui/gui/menu/mod_selector_page.tl:314
function(result : Modhub.AsyncResult<Modhub.SubscriptionData>)

Modhub.RefreshData

record api/tealdef/api/type/modhub.d.tl:368

record RefreshData

Access: api.type.modhub.RefreshData

Notes

Result data of api.modhub.refreshAsync and Modhub.ModPublishHelper.refresh.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1318

mod_manager_react_util.setAsyncRef(asyncRef, api.modhub.refreshAsync(params.context.backendId, function(result : Modhub.AsyncResult<Modhub.RefreshData>)

Fields

Name Type Description
numRefreshed integer Number of mods that were refreshed.

Modhub.ForceUninstallModRequest

record api/tealdef/api/type/modhub.d.tl:372

record ForceUninstallModRequest

Access: api.type.modhub.ForceUninstallModRequest

Notes

Request for api.modhub.forceUninstallModAsync.

Fields

Name Type Description
modId ModId Id of the mod to uninstall.

Functions

new(ModId) : ForceUninstallModRequest api/tealdef/api/type/modhub.d.tl:373

Call as api.type.modhub.ForceUninstallModRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.

Returns ForceUninstallModRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3604

local request = api.type.modhub.ForceUninstallModRequest.new(params.modId)

Modhub.ForceUninstallModData

record api/tealdef/api/type/modhub.d.tl:377

record ForceUninstallModData

Access: api.type.modhub.ForceUninstallModData

Notes

Result data of api.modhub.forceUninstallModAsync (no fields).

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3607

function(result : Modhub.AsyncResult<Modhub.ForceUninstallModData>)

Modhub.SpecialRefreshModRequest

record api/tealdef/api/type/modhub.d.tl:380

record SpecialRefreshModRequest

Access: api.type.modhub.SpecialRefreshModRequest

Notes

Request for api.modhub.specialRefreshModAsync, which the mod manager uses to retry (or drop) a mod that could not be installed for lack of space.

Fields

Name Type Description
modId ModId Id of the mod.
unsubscribe boolean Whether to unsubscribe from the mod instead of retrying.

Functions

new(ModId, boolean) : SpecialRefreshModRequest api/tealdef/api/type/modhub.d.tl:381

Call as api.type.modhub.SpecialRefreshModRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.
#2 boolean Whether to unsubscribe from the mod.

Returns SpecialRefreshModRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:827

async = api.modhub.specialRefreshModAsync(params.context.backendId, api.type.modhub.SpecialRefreshModRequest.new(params.modId, unsubscribe), function(result : M

Modhub.SpecialRefreshModData

record api/tealdef/api/type/modhub.d.tl:386

record SpecialRefreshModData

Access: api.type.modhub.SpecialRefreshModData

Notes

Result data of api.modhub.specialRefreshModAsync (no fields).

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:827

async = api.modhub.specialRefreshModAsync(params.context.backendId, api.type.modhub.SpecialRefreshModRequest.new(params.modId, unsubscribe), function(result : M

Modhub.RestartModBackendData

record api/tealdef/api/type/modhub.d.tl:389

record RestartModBackendData

Access: api.type.modhub.RestartModBackendData

Notes

Result data of api.modhub.restartModBackendAsync (no fields); the mod manager calls it from the Retry Download button.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:643

function(_result : Modhub.AsyncResult<Modhub.RestartModBackendData>) end)

Modhub.SubmitModRatingRequest

record api/tealdef/api/type/modhub.d.tl:392

record SubmitModRatingRequest

Access: api.type.modhub.SubmitModRatingRequest

Notes

Request for api.modhub.submitModRatingAsync.

Fields

Name Type Description
modId ModId Id of the mod.
rating RatingType The new rating.

Functions

new(ModId, RatingType) : SubmitModRatingRequest api/tealdef/api/type/modhub.d.tl:393

Call as api.type.modhub.SubmitModRatingRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.
#2 RatingType The new rating; Neutral withdraws a like or dislike.

Returns SubmitModRatingRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1082

local request = api.type.modhub.SubmitModRatingRequest.new(params.modInfo.modId, newRating)

Modhub.SubmitModRatingData

record api/tealdef/api/type/modhub.d.tl:398

record SubmitModRatingData

Access: api.type.modhub.SubmitModRatingData

Notes

Result data of api.modhub.submitModRatingAsync.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1083

local async = api.modhub.submitModRatingAsync(params.context.backendId, request, function(result : Modhub.AsyncResult<Modhub.SubmitModRatingData>)

Fields

Name Type Description
rating RatingType The rating stored by the backend.

Modhub.SubmitModReportRequest

record api/tealdef/api/type/modhub.d.tl:402

record SubmitModReportRequest

Access: api.type.modhub.SubmitModReportRequest

Notes

Request for api.modhub.submitModReportAsync: reports a mod to the backend.

Fields

Name Type Description
modId ModId Id of the reported mod.
type ReportType Reason of the report.
reportDescription string Report text.
reporterName string Name of the reporter.
reporterContact string Contact (email) of the reporter.

Functions

new(ModId, ReportType, string, ?string, ?string) : SubmitModReportRequest api/tealdef/api/type/modhub.d.tl:403

Call as api.type.modhub.SubmitModReportRequest.new(…)

Notes

Creates the request.

Parameter Type Description
#1 ModId Id of the mod.
#2 ReportType Reason of the report.
#3 string Report text (required by the base dialog).
#4 ?string Optional name of the reporter.
#5 ?string Optional contact (email) of the reporter.

Returns SubmitModReportRequest

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3338

local request = api.type.modhub.SubmitModReportRequest.new(params.modId, state.reportType, state.comment,  state.name, state.email)

Modhub.SubmitModReportData

record api/tealdef/api/type/modhub.d.tl:412

record SubmitModReportData

Access: api.type.modhub.SubmitModReportData

Notes

Result data of api.modhub.submitModReportAsync.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:3341

function(result : Modhub.AsyncResult<Modhub.SubmitModReportData>)

Fields

Name Type Description
response Response Outcome of the report.

Modhub.SubmitModReportData.Response

record api/tealdef/api/type/modhub.d.tl:413

record Response

Access: api.type.modhub.SubmitModReportData.Response

Notes

Outcome of a report.

Fields

Name Type Description
ValidationError Response The report was rejected; the input should be checked. used 1× in the base game
Submitted Response The report was submitted.

Modhub.PartialUploadError

record api/tealdef/api/type/modhub.d.tl:421

record PartialUploadError

Access: api.type.modhub.PartialUploadError

Notes

Error of one step of an otherwise successful upload (UploadModData.partialErrors).

Fields

Name Type Description
step string Name of the upload step that failed.
error ModHubErrorCode The error of that step.

Modhub.UploadModData

record api/tealdef/api/type/modhub.d.tl:426

record UploadModData

Access: api.type.modhub.UploadModData

Notes

Result data of Modhub.ModPublishHelper.publish.

Fields

Name Type Description
modId ModId Remote id of the published mod (e.g. its mod.io id).
partialErrors {PartialUploadError} Steps that failed although the upload as a whole succeeded; the GUI lists them to the user.

Modhub.UniquePendingRequestId

record api/tealdef/api/type/modhub.d.tl:431

record UniquePendingRequestId

Access: api.type.modhub.UniquePendingRequestId

Notes

Handle of a running asynchronous modhub request, returned by the api.modhub.*Async functions.

Used in the base game: 9 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:28

mod_manager_react_util.createAsyncRef = function() : ReactRefT<Modhub.UniquePendingRequestId>

Functions

abort(UniquePendingRequestId) api/tealdef/api/type/modhub.d.tl:432

Call as api.type.modhub.UniquePendingRequestId.abort(…)

Notes

Cancels the request; its callback is then not needed any more.

Details

The mod manager keeps the handle in a React ref and aborts it when the component unmounts or when a newer request replaces it (mod_manager_react_util.setAsyncRef).

Modhub.AsyncResult

record api/tealdef/api/type/modhub.d.tl:435

record AsyncResult<T>

Access: api.type.modhub.AsyncResult

Notes

Result passed to the callback of an asynchronous modhub request. T is the request's data type.

Example

api.modhub.refreshAsync(backendId, function(result)
  if not result:isSuccess() then
    print(result:getError().code)
  else
    print(result:getData().numRefreshed)
  end
end)
Used in the base game: 21 times in 2 files

base/content/gui/gui/menu/mod_manager_react_util.tl:160

local async = api.modhub.getModMediaAsync(params.context.backendId, request, function(result : Modhub.AsyncResult<Modhub.ModMediaData>)
base/content/gui/gui/menu/mod_selector_page.tl:314
function(result : Modhub.AsyncResult<Modhub.SubscriptionData>)

Functions

isSuccess(AsyncResult<T>) : boolean api/tealdef/api/type/modhub.d.tl:436

Call as asyncResult:isSuccess(…) (method)

Notes

Returns whether the request succeeded.

Returns boolean

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_selector_page.tl:315

if not result:isSuccess() then

getData(AsyncResult<T>) : T api/tealdef/api/type/modhub.d.tl:437

Call as api.type.modhub.AsyncResult.getData(…)

Notes

Returns the result data; use it only when isSuccess() is true.

Returns T

getError(AsyncResult<T>) : ModHubErrorCode api/tealdef/api/type/modhub.d.tl:438

Call as asyncResult:getError(…) (method)

Notes

Returns the error of a failed request.

Returns ModHubErrorCode

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_selector_page.tl:316

params.selectorApi.showError(_("Failed To Subscribe"), result:getError())

Modhub.ModBrowserDisplayData

record api/tealdef/api/type/modhub.d.tl:443

record ModBrowserDisplayData

Access: api.type.modhub.ModBrowserDisplayData

Notes

Current page of a mod browser, from Modhub.ModBrowserDataProvider.getDisplayData.

Used in the base game: 5 times in 3 files

base/content/gui/gui/menu/mod_manager_page.tl:78

displayData : Modhub.ModBrowserDisplayData,
base/content/gui/gui/menu/mod_manager_react_util.tl:4576
displayData : Modhub.ModBrowserDisplayData
base/content/gui/gui/menu/mod_selector_page.tl:139
displayData : Modhub.ModBrowserDisplayData,

Fields

Name Type Description
entries {Entry} nil: is currently loading, empty: no results
error Modhub.ModHubErrorCode nil: no error, otherwise error should be shown to user
currentPage integer Current page (0-based); the GUI shows a Show More button while currentPage < numPages - 1.
numPages integer Number of pages.
displayPerPage integer Number of mods per page.
totalResults integer Total number of matching mods.
appendResults boolean
searchString string Current search text.
sortType Modhub.SortType Current sort order.
hasNoSortTag boolean
filterTags {string} Tags currently toggled as filters.
excludeTags {string} Tags whose mods are excluded; the mod selector hides installed mods carrying any of them.

Modhub.ModBrowserDisplayData.Entry

record api/tealdef/api/type/modhub.d.tl:444

record Entry

Access: api.type.modhub.ModBrowserDisplayData.Entry

Notes

One mod in the browser list.

Fields

Name Type Description
backendId BackendId Backend the mod comes from.
modInfo ModInfo Summary information of the mod.
modId Mod.ModId Id of the mod in the local mod repository.

Modhub.ModBrowserDataProvider

record api/tealdef/api/type/modhub.d.tl:464

record ModBrowserDataProvider

Access: api.type.modhub.ModBrowserDataProvider

Notes

Paged, sortable and filterable mod list behind a mod browser tab or the mod selector. Poll getDisplayData() every step to render it.

Example

local provider = api.type.modhub.ModBrowserDataProvider.new(backendId, 12)
provider:setSearchString("station")
-- later, e.g. in react.onStep:
local displayData = provider:getDisplayData()
if displayData.entries ~= nil then print(#displayData.entries) end
Used in the base game: 5 times in 3 files

base/content/gui/gui/menu/mod_manager_page.tl:29

local dataProviders : {string:ReactRefT<Modhub.ModBrowserDataProvider>} = {}
base/content/gui/gui/menu/mod_manager_react_util.tl:4579
local modBrowserDataProviderRef : ReactRefT<Modhub.ModBrowserDataProvider> = params.dataProvider
base/content/gui/gui/menu/mod_selector_page.tl:29
getSelectorDataProvider : function() : Modhub.ModBrowserDataProvider

Functions

new(BackendId, integer) : ModBrowserDataProvider api/tealdef/api/type/modhub.d.tl:465

Call as api.type.modhub.ModBrowserDataProvider.new(…)

Notes

Creates a provider that lists the mods of a modhub backend.

Parameter Type Description
#1 BackendId Backend to list.
#2 integer Number of mods per page.

Returns ModBrowserDataProvider

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_page.tl:220

dataProviders[tabKey]:set(api.type.modhub.ModBrowserDataProvider.new(backendId, mod_manager_react_util.DisplayPerPage))

newForSelector(integer, function(mod1 : Mod.ModId, mod2 : Mod.ModId), gameModDescs : {Mod.GameModDesc}) : ModBrowserDataProvider api/tealdef/api/type/modhub.d.tl:466

Call as api.type.modhub.ModBrowserDataProvider.newForSelector(…)

Notes

Creates a provider for the mod selector, listing local mods.

Parameter Type Description
#1 integer Number of mods per page.
#2 function(mod1 : Mod.ModId, mod2 : Mod.ModId) Custom sort function for SortType.Custom; the base mod selector returns true if mod1 comes before mod2 and nil when it has no preference.
gameModDescs {Mod.GameModDesc} Mods of the savegame, so that missing ones can be listed.

Returns ModBrowserDataProvider

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_selector_page.tl:754

modSelectorProvider:set(api.type.modhub.ModBrowserDataProvider.newForSelector(mod_manager_react_util.DisplayPerPage, customSortFn,

suspend(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:468

Call as api.type.modhub.ModBrowserDataProvider.suspend(…)

Notes

Pauses the provider, e.g. when its tab is hidden or the page unmounts.

resume(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:469

Call as api.type.modhub.ModBrowserDataProvider.resume(…)

Notes

Resumes a suspended provider.

getDisplayData(ModBrowserDataProvider) : ModBrowserDisplayData api/tealdef/api/type/modhub.d.tl:470

Call as api.type.modhub.ModBrowserDataProvider.getDisplayData(…)

Notes

Returns the current page and state of the list.

Returns ModBrowserDisplayData

setLoadPage(ModBrowserDataProvider, integer) api/tealdef/api/type/modhub.d.tl:471

Call as api.type.modhub.ModBrowserDataProvider.setLoadPage(…)

Notes

Requests that the given page be loaded; the mod browser passes the next page when the list is scrolled to the end, else 0.

Parameter Type Description
#1 ModBrowserDataProvider
#2 integer Page to load (0-based).

setNextContinuousPage(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:472

Call as api.type.modhub.ModBrowserDataProvider.setNextContinuousPage(…)

Notes

Appends the next page to the list (Show More button).

setCurrentPage(ModBrowserDataProvider, integer) api/tealdef/api/type/modhub.d.tl:473

Call as api.type.modhub.ModBrowserDataProvider.setCurrentPage(…)

Notes

Jumps to a page.

Parameter Type Description
#1 ModBrowserDataProvider
#2 integer Page number (0-based).

setSearchString(ModBrowserDataProvider, string) api/tealdef/api/type/modhub.d.tl:474

Call as api.type.modhub.ModBrowserDataProvider.setSearchString(…)

Notes

Sets the search text.

Parameter Type Description
#1 ModBrowserDataProvider
#2 string Search text.

setSearchUserId(ModBrowserDataProvider, UserId) api/tealdef/api/type/modhub.d.tl:475

Call as api.type.modhub.ModBrowserDataProvider.setSearchUserId(…)

Notes

Lists only the mods of one author; an invalid id (api.type.modhub.UserId.new()) clears the author filter.

Parameter Type Description
#1 ModBrowserDataProvider
#2 UserId Author's user id.

setNextPage(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:476

Call as api.type.modhub.ModBrowserDataProvider.setNextPage(…)

Notes

Goes to the next page.

setPreviousPage(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:477

Call as api.type.modhub.ModBrowserDataProvider.setPreviousPage(…)

Notes

Goes to the previous page.

refreshCurrentPage(ModBrowserDataProvider, boolean) api/tealdef/api/type/modhub.d.tl:478

Call as api.type.modhub.ModBrowserDataProvider.refreshCurrentPage(…)

Notes

Reloads the current page, e.g. after an error or a change of the custom sort order.

getSortType(ModBrowserDataProvider) : Modhub.SortType api/tealdef/api/type/modhub.d.tl:479

Call as api.type.modhub.ModBrowserDataProvider.getSortType(…)

Notes

Returns the current sort order.

Returns Modhub.SortType

getTagToggled(ModBrowserDataProvider, string) : boolean api/tealdef/api/type/modhub.d.tl:480

Call as api.type.modhub.ModBrowserDataProvider.getTagToggled(…)

Notes

Returns whether a filter tag is toggled on.

Parameter Type Description
#1 ModBrowserDataProvider
#2 string The tag.

Returns boolean

setSortType(ModBrowserDataProvider, SortType) api/tealdef/api/type/modhub.d.tl:481

Call as api.type.modhub.ModBrowserDataProvider.setSortType(…)

Notes

Sets the sort order.

Parameter Type Description
#1 ModBrowserDataProvider
#2 SortType The sort order.

setNextSortType(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:482

Call as api.type.modhub.ModBrowserDataProvider.setNextSortType(…)

Notes

Switches to the next available sort order.

toggleTag(ModBrowserDataProvider, string) api/tealdef/api/type/modhub.d.tl:483

Call as api.type.modhub.ModBrowserDataProvider.toggleTag(…)

Notes

Toggles a filter tag on or off.

Parameter Type Description
#1 ModBrowserDataProvider
#2 string The tag.

resetFilters(ModBrowserDataProvider) api/tealdef/api/type/modhub.d.tl:484

Call as api.type.modhub.ModBrowserDataProvider.resetFilters(…)

Notes

Clears all filter tags.

getSortAndFilterOptions(ModBrowserDataProvider) : Modhub.SortAndFilterOptions api/tealdef/api/type/modhub.d.tl:486

Call as api.type.modhub.ModBrowserDataProvider.getSortAndFilterOptions(…)

Notes

Returns the sort options and filter tag groups available for this list.

Returns Modhub.SortAndFilterOptions

Modhub.StagingModData

record api/tealdef/api/type/modhub.d.tl:489

record StagingModData

Access: api.type.modhub.StagingModData

Notes

Publishing state of a mod in the staging area, from Modhub.ModPublishHelper.getStagingModData.

Used in the base game: 3 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1400

stagingData : Modhub.StagingModData

Fields

Name Type Description
localModhubDetails Modhub.ModDetailsData Locally edited details (title, tags, ...) of the mod; edit a copy and pass it to ModPublishHelper.setModDetails.
state State Current publishing state.
modhubId Modhub.ModId Remote id of the mod; invalid if it was never published.
modhubDetails Modhub.ModDetailsData Details of the published mod in the backend, or nil if it does not exist (any more).
publishResult AsyncResult<UploadModData> Result of the last upload, set in state HasResult.

Functions

equals(StagingModData, StagingModData) : boolean api/tealdef/api/type/modhub.d.tl:497

Call as api.type.modhub.StagingModData.equals(…)

Notes

Returns true when both StagingModData values are equal.

Returns boolean

Modhub.StagingModData.State

record api/tealdef/api/type/modhub.d.tl:490

record State

Access: api.type.modhub.StagingModData.State

Notes

Publishing state of a staging mod.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1397

state : Modhub.StagingModData.State

Fields

Name Type Description
Sync State Still synchronising with the backend; publishing is not possible yet. used 8× in the base game
Ready State Ready to be published or edited. used 20× in the base game
Publishing State An upload is running. used 2× in the base game
HasResult State The upload finished; see publishResult. used 3× in the base game

Modhub.ValidationData

record api/tealdef/api/type/modhub.d.tl:509

record ValidationData

Access: api.type.modhub.ValidationData

State of the validation of a single staging mod, see ModPublishHelper.validate

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1401

validationData : Modhub.ValidationData

Fields

Name Type Description
validating boolean Whether a validation started with ModPublishHelper.validate is still running
progress number Progress of the running validation, in [0, 1]
task string Name of the task the running validation is currently busy with
result Modhub.ModValidatorResult Result of the last completed validation, nil if the mod wasn't validated yet

Functions

equals(ValidationData, ValidationData) : boolean api/tealdef/api/type/modhub.d.tl:510

Call as api.type.modhub.ValidationData.equals(…)

Notes

Returns true when both ValidationData values are equal.

Returns boolean

Modhub.PublishSettings

record api/tealdef/api/type/modhub.d.tl:522

record PublishSettings

Access: api.type.modhub.PublishSettings

Notes

Options for Modhub.ModPublishHelper.publish. Create one with new() or copy one with new(settings).

Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1405

local publishSettings : ReactStateT<Modhub.PublishSettings> = react.useState(api.type.modhub.PublishSettings.new())

Fields

Name Type Description
changeLog string Change log text of this upload.
updateMetadata boolean Whether to update the mod's metadata (title, description, images, tags) in the backend.
setPublic boolean Whether to make the mod public.
isSavegame boolean Shared savegames are uploaded as staged, they are not validated or cooked
issuesConfirmed boolean The user confirmed the issues the last validation reported, so publishing only aborts if the validation it runs comes back worse than those
additionalMetadata {string : any} Free-form extra metadata merged into the upload's metadata (eg. mapSize for savegames)

Functions

new() : PublishSettings api/tealdef/api/type/modhub.d.tl:523

Call as api.type.modhub.PublishSettings.new(…)

Notes

Creates a new, empty PublishSettings.

Returns PublishSettings

Used in the base game: 7 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1405

local publishSettings : ReactStateT<Modhub.PublishSettings> = react.useState(api.type.modhub.PublishSettings.new())

new(PublishSettings) : PublishSettings api/tealdef/api/type/modhub.d.tl:524

Call as api.type.modhub.PublishSettings.new(…)

Notes

Creates a new, empty PublishSettings.

Returns PublishSettings

Used in the base game: 7 times in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:1405

local publishSettings : ReactStateT<Modhub.PublishSettings> = react.useState(api.type.modhub.PublishSettings.new())

Modhub.ModPublishHelper

record api/tealdef/api/type/modhub.d.tl:540

record ModPublishHelper

Access: api.type.modhub.ModPublishHelper

Notes

Manages mods in the local staging area and publishes them to a backend (validation, metadata, images, upload).

Used in the base game: 2 times in 2 files

base/content/gui/gui/menu/mod_manager_page.tl:72

local modPublishHelperRef : ReactRefT<Modhub.ModPublishHelper> = react.useRef(nil)
base/content/gui/gui/menu/mod_manager_react_util.tl:3979
local modPublishHelperRef : ReactRefT<Modhub.ModPublishHelper> = react.useRef(nil)

Functions

new(BackendId) : ModPublishHelper api/tealdef/api/type/modhub.d.tl:541

Call as api.type.modhub.ModPublishHelper.new(…)

Notes

Creates a publish helper for a backend.

Parameter Type Description
#1 BackendId Backend to publish to.

Returns ModPublishHelper

Used in the base game: 2 times in 2 files

base/content/gui/gui/menu/mod_manager_page.tl:182

modPublishHelperRef:set(api.type.modhub.ModPublishHelper.new(publishBackendId))
base/content/gui/gui/menu/mod_manager_react_util.tl:3993
local modPublishHelper = api.type.modhub.ModPublishHelper.new(modPublishBackendId)

hasAnyStagingMods(publishHelper : ModPublishHelper) : boolean api/tealdef/api/type/modhub.d.tl:545

Call as api.type.modhub.ModPublishHelper.hasAnyStagingMods(…)

Checks if there are any mods in the staging area

Parameter Type Description
publishHelper ModPublishHelper the publish helper

Returns boolean

canRefresh(publishHelper : ModPublishHelper) : boolean api/tealdef/api/type/modhub.d.tl:549

Call as api.type.modhub.ModPublishHelper.canRefresh(…)

Checks if the publish helper can be refreshed

Parameter Type Description
publishHelper ModPublishHelper the publish helper

Returns boolean

refresh(publishHelper : ModPublishHelper) : AsyncResult<RefreshData> api/tealdef/api/type/modhub.d.tl:553

Call as api.type.modhub.ModPublishHelper.refresh(…)

Refreshes the mod helper, this is an async operation

Parameter Type Description
publishHelper ModPublishHelper the publish helper

Returns AsyncResult<RefreshData>: the result of the async operation, including the number of mods that were refreshed

update(publishHelper : ModPublishHelper) api/tealdef/api/type/modhub.d.tl:556

Call as api.type.modhub.ModPublishHelper.update(…)

Polls the pending validations, has to be called regularly while a validation is running

Parameter Type Description
publishHelper ModPublishHelper the publish helper

validate(publishHelper : ModPublishHelper, modId : Modhub.ModId) api/tealdef/api/type/modhub.d.tl:563

Call as api.type.modhub.ModPublishHelper.validate(…)

Validates a staging mod, this is an async operation. Aborts a validation that is already running for that mod. The result ends up in ValidationData.result once ValidationData.validating turned false again. Does not cook, only publish does.

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

abortValidation(publishHelper : ModPublishHelper, modId : Modhub.ModId) api/tealdef/api/type/modhub.d.tl:567

Call as api.type.modhub.ModPublishHelper.abortValidation(…)

Aborts a running validation

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

getValidationData(publishHelper : ModPublishHelper, modId : Modhub.ModId) : ValidationData api/tealdef/api/type/modhub.d.tl:571

Call as api.type.modhub.ModPublishHelper.getValidationData(…)

Returns the validation state of a staging mod

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

Returns ValidationData

hasStagingMod(publishHelper : ModPublishHelper, modId : Modhub.ModId) : boolean api/tealdef/api/type/modhub.d.tl:576

Call as modPublishHelper:hasStagingMod(…) (method)

Checks if a specific mod is in the staging area

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

Returns boolean

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:5573

if (modPublishHelper:hasStagingMod(params.modId) == false) then

getStagingModData(publishHelper : ModPublishHelper, modId : Modhub.ModId) : StagingModData api/tealdef/api/type/modhub.d.tl:580

Call as modPublishHelper:getStagingModData(…) (method)

Returns the staging mod data for a specific mod

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

Returns StagingModData

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:5579

local data = modPublishHelper:getStagingModData(params.modId)

setModDetails(publishHelper : ModPublishHelper, modId : Modhub.ModId, modDetailsData : Modhub.ModDetailsData) api/tealdef/api/type/modhub.d.tl:585

Call as api.type.modhub.ModPublishHelper.setModDetails(…)

Sets the mod details data

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the local mod id of the mod to update
modDetailsData Modhub.ModDetailsData the mod details data

setRemoteModId(publishHelper : ModPublishHelper, localModId : Modhub.ModId, remoteModId : Modhub.ModId) api/tealdef/api/type/modhub.d.tl:590

Call as api.type.modhub.ModPublishHelper.setRemoteModId(…)

Update the local modId of a mod to the remote (eg. mod.io) mod.io of the mod when publishing

Parameter Type Description
publishHelper ModPublishHelper the publish helper
localModId Modhub.ModId the local mod id of the mod to update
remoteModId Modhub.ModId the remote mod id to set

publish(publishHelper : ModPublishHelper, modId : Modhub.ModId, publishSettings : PublishSettings) : AsyncResult<UploadModData> api/tealdef/api/type/modhub.d.tl:598

Call as api.type.modhub.ModPublishHelper.publish(…)

Publishes a mod (eg. on mod.io), this is an async call. Validates and cooks the mod once more first and uploads the cooked folders, unless the settings mark it as a savegame; see PublishSettings.isSavegame and PublishSettings.issuesConfirmed

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id
publishSettings PublishSettings the publish settings

Returns AsyncResult<UploadModData>: the result of the async call, also contains the remote mod id

abortPublish(publishHelper : ModPublishHelper, modId : Modhub.ModId) : UniquePendingRequestId api/tealdef/api/type/modhub.d.tl:602

Call as api.type.modhub.ModPublishHelper.abortPublish(…)

Aborts the publication of a mod

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

Returns UniquePendingRequestId

addLogoImage(publishHelper : ModPublishHelper, modId : Modhub.ModId, image : string) api/tealdef/api/type/modhub.d.tl:608

Call as api.type.modhub.ModPublishHelper.addLogoImage(…)

Adds a list of image to the mod gallery

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id
image string image file to add to the gallery

removeLogoImage(publishHelper : ModPublishHelper, modId : Modhub.ModId) api/tealdef/api/type/modhub.d.tl:613

Call as api.type.modhub.ModPublishHelper.removeLogoImage(…)

Removes the logo image

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id

Documented in the game files as:

  • index: the index of the image in the gallery to remove

addGalleryImages(publishHelper : ModPublishHelper, modId : Modhub.ModId, images : {string}) api/tealdef/api/type/modhub.d.tl:619

Call as api.type.modhub.ModPublishHelper.addGalleryImages(…)

Adds a list of image to the mod gallery

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id
images {string} the list of image file to add to the gallery

removeGalleryImage(publishHelper : ModPublishHelper, modId : Modhub.ModId, index : integer) api/tealdef/api/type/modhub.d.tl:624

Call as api.type.modhub.ModPublishHelper.removeGalleryImage(…)

Removes an image from the mod gallery

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id
index integer the index of the image in the gallery to remove

moveGalleryImage(publishHelper : ModPublishHelper, modId : Modhub.ModId, fromIndex : integer, toIndex : integer) api/tealdef/api/type/modhub.d.tl:630

Call as api.type.modhub.ModPublishHelper.moveGalleryImage(…)

Moves an image position in the mod gallery

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id
fromIndex integer the index in the mod gallery of the image to move
toIndex integer the new position of the image in the mod gallery

setPostPublishFn(publishHelper : ModPublishHelper, modId : Modhub.ModId, publishFn : function(Modhub.ModId)) api/tealdef/api/type/modhub.d.tl:636

Call as modPublishHelper:setPostPublishFn(…) (method)

Set a function called after a mod has been successfuly published

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the mod id
publishFn function(Modhub.ModId) a function called after the mod has been published, the function gives the remote mod id as parameter
Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/mod_manager_react_util.tl:4011

modPublishHelper:setPostPublishFn(localModId, function(actualModhubId : Modhub.ModId)

openFolder(publishHelper : ModPublishHelper, modId : Modhub.ModId) api/tealdef/api/type/modhub.d.tl:641

Call as api.type.modhub.ModPublishHelper.openFolder(…)

Opens the mod folder

Parameter Type Description
publishHelper ModPublishHelper the publish helper
modId Modhub.ModId the modId

getSortAndFilterOptions(publishHelper : ModPublishHelper) : Modhub.SortAndFilterOptions api/tealdef/api/type/modhub.d.tl:646

Call as api.type.modhub.ModPublishHelper.getSortAndFilterOptions(…)

Gets the list of sorting and filtering options (eg. tags)

Parameter Type Description
publishHelper ModPublishHelper the publish helper

Returns Modhub.SortAndFilterOptions: an object containing the list of sort and filter options