Fonthelper
Based on game build 714014 | Last updated: 2026-03-10
Overview
fonthelper is a utility module that provides a single function AddFontAssets to register font assets with the game's asset system. It is used during mod initialization to ensure custom font files (e.g., .ttf, .otf) are properly loaded and referenced in asset_table and font_table structures. This component does not implement an Entity Component System component; it is a standalone helper for asset management.
Usage example
local ASSETS = {}
local FONTS = {
{ filename = "fonts/myfont.ttf" },
{ filename = "fonts/altfont.ttf" },
}
AddFontAssets(ASSETS, FONTS)
-- ASSETS now contains Asset("FONT", ...) entries for each font
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
No public properties
Main functions
AddFontAssets(asset_table, font_table)
- Description: Iterates through a table of font definitions and appends corresponding
Asset("FONT", ...)objects to an asset collection table. This prepares custom fonts to be loaded by the game’s asset system (e.g., viaTheInput:GetFontAssetorTheSim:GetAsset). - Parameters:
asset_table(table) — A mutable array-like table (typicallyASSETS) to whichAssetobjects will be appended.font_table(table) — An array of tables, each containing afilenamekey specifying the path to a font file.
- Returns: Nothing (modifies
asset_tablein place). - Error states: No explicit error handling is provided; if
font_tableis malformed (e.g., missingfilename), the innerAssetcall may fail at runtime.
Events & listeners
Not applicable