API ReferenceGE Extensionscore
Highscores
Persistent highscore storage for scenario races. Stores per-scenario, per-config lap times with player and vehicle info, sorted by fastest time.
Persistent highscore storage for scenario races. Stores per-scenario, per-config lap times with player and vehicle info, sorted by fastest time.
Public API
| Function | Signature | Description |
|---|---|---|
M.getHighscores | () → table | Returns the full highscore table from settings/highscores.json. Handles migration from old file location. |
M.setHighscores | (scores) | Writes the full highscore table to disk. |
M.getScenarioHighscores | (levelName, scenarioName, configKey) → table | Returns sorted highscores for a specific scenario+config, with place indices. |
M.setScenarioHighscores | (timeInMillis, vehicleBrand, vehicleName, playerName, levelName, scenarioName, configKey) → number | Records a time. Returns placement index (1-based) or -1 if beyond max count. |
M.setScenarioHighscoresCustom | (timeInMillis, record, levelName, scenarioName, configKey) → number | Records a custom record table. Returns placement index or -1. |
Record Format
{
playerName = "Player",
vehicleBrand = "Gavril",
vehicleName = "D-Series",
timeInMillis = 63250,
formattedTime = "01:03.250",
timeStamp = 1700000000,
formattedTimestamp = "Tue Nov 14 ...",
detailed = false,
}Constants
| Name | Value | Description |
|---|---|---|
maxHighScoreCount | 50 | Maximum number of scores kept per scenario config. |
highscoreFile | settings/highscores.json | Storage file path. |
Storage Structure
{
["levelName"] = {
["scenarioName"] = {
["configKey"] = { -- array of records sorted by timeInMillis
{ timeInMillis = 60000, ... },
{ timeInMillis = 61500, ... },
}
}
}
}Usage Example
-- Record a lap time
local place = core_highscores.setScenarioHighscores(
63250, "Gavril", "D-Series", "Player1",
"west_coast_usa", "drag_strip", "default"
)
if place > 0 then
log('I', 'race', 'New highscore! Place: ' .. place)
end
-- Read scenario scores
local scores = core_highscores.getScenarioHighscores("west_coast_usa", "drag_strip", "default")
for _, s in ipairs(scores) do
print(s.place .. ": " .. s.formattedTime)
endHardware Info
Gathers and reports system hardware information (CPU, GPU, memory, disk, OS, power) with health warnings for low resources, unsupported hardware, and mod overload.
Hotlapping
Full hotlapping / lap timing system. Supports creating custom circuits in freeroam (edit mode), running timed laps with checkpoint splits, best-lap tracking, and integration with both the old scenario