Docs / Plugins / Lua plugins
Reading the complete loaded HOF
omsi.hof.get() returns an owned snapshot of every field parsed from the player's
currently loaded depot file.
It includes the depot name and source path, service-trip identifier, global strings, declared string counts, all termini and bus stops (including their internal identifiers and every string), and the info-system trips, stop lists and stop rows.
Empty strings and original ordering are preserved; info_trips[].code stays
a string, including leading zeroes. Comments and unrecognized file directives are not
part of the parsed data. The API does not open arbitrary HOF files or alter the depot. It is shared by Lua and WASM on every game platform and requires no extra permission.
Use omsi.hof.terminus(identifier) for a single timetable destination or
omsi.hof.busstop(identifier) for a single stop, without copying the whole depot. Both return the first exact, case-sensitive identifier match, or nil without a match,
player vehicle or loaded HOF.
Returned index fields are zero-based, as the existing
GetTerminusString and GetBusstopString getters expect; arrays in Lua start at 1. For a terminus, identifier is the HOF's internal texture/change identifier, not a
display string or numeric IBIS code. terminus_stop is absent when the HOF has none.
GetTTTerminusIndex reads the current vehicle timetable state and accepts no trip
argument. To resolve every trip of a tour without changing that state:
local tour = omsi.duty.tour()
if tour then
for _, trip in ipairs(tour.trips) do
local terminus = omsi.hof.terminus(trip.terminus)
if terminus then
-- Getter fields 8 and 9 are Lua array elements 9 and 10.
local kind = terminus.strings[9] or ""
local route = terminus.strings[10] or ""
print(trip.name, terminus.index, terminus.code, kind, route)
end
end
endSnapshots are independent copies: changing a returned table does not change the game. Keep a snapshot for repeated reads rather than copying the whole depot every frame; read a fresh one when the vehicle or its HOF changes. Lookups always use the current HOF.
Something wrong or missing? Fix it on GitHub or open an issue.