Logo FSBarV1_Archived

ArchiveCache Module

Parses the engine-generated `ArchiveCache20.lua` to recover the engine-registered map name for each installed `.sd7` map archive. The engine does NOT accept archive filename stems as the `MapName` in start scripts — it requires the map's *declared* name (e.g. "Avalanche 3.4"), which is typically `name_pure + " " + version` but can include bespoke formatting inside `mapinfo.lua`. The engine's archive cache is the authoritative source for this string; this module mirrors the exact value the engine will match against at start time.

Types

Type Description

MapEntry

A single map archive entry as the engine registered it.

Functions and values

Function or value Description

defaultCachePath dataDir

Full Usage: defaultCachePath dataDir

Parameters:
    dataDir : string

Returns: string

Default cache path relative to a BAR data dir — `/cache/ArchiveCache20.lua`.

dataDir : string
Returns: string

loadMaps cachePath

Full Usage: loadMaps cachePath

Parameters:
    cachePath : string

Returns: MapEntry list

Reads and parses the archive cache. Returns `[]` when the file does not exist or cannot be read. Emits only map entries (`modtype = 3`).

cachePath : string
Returns: MapEntry list

loadMapsForDataDir dataDir

Full Usage: loadMapsForDataDir dataDir

Parameters:
    dataDir : string

Returns: MapEntry list

Convenience: `loadMaps` against the default cache path for the given data dir.

dataDir : string
Returns: MapEntry list

parse content

Full Usage: parse content

Parameters:
    content : string

Returns: MapEntry list

Pure parser exposed for unit tests. Accepts the raw Lua source of `ArchiveCache20.lua` and returns the map entries.

content : string
Returns: MapEntry list

Type something to start searching.