EXAMPLE 01 RETAIL + CLASSIFIED
Player HUD
Show your class, health and movement speed when a local player snapshot is available.
Download Lua ↓TF2 & TF2 CLASSIFIED
Start with a small overlay, add custom controls, or explore the copied game data. Both editions share the core tf2 API. Classified also supports the tf2c alias and its labeled edition-specific entries.
Host API 1.0 Shared UI API 1.1
EXAMPLE 01 RETAIL + CLASSIFIED
Show your class, health and movement speed when a local player snapshot is available.
Download Lua ↓EXAMPLE 02 RETAIL + CLASSIFIED
A toggleable overlay of recognized players with distance filtering and screen projection.
Download Lua ↓EXAMPLE 03 RETAIL + CLASSIFIED
Print the game, API version, four-team support and session availability in the console.
Download Lua ↓.lua example.The HUD and player labels draw only when an eligible local session supplies live data. Edition Info also works without a live player.
| Check | Retail TF2 | TF2 Classified |
|---|---|---|
tf2.info().game_id | tf2 | tf2_classified |
| Lua global | tf2 | tf2 and tf2c |
| Edition capabilities | MvM, viewmodel offsets | Four teams, Civilian |
Read tf2.capabilities() and check individual settings with tf2.has_feature(id). Capabilities describe implemented interfaces, not complete gameplay acceptance.
assert(TF2_API_VERSION == "1.0", "Update the TF2 Lua host")
local info = tf2.info()
local caps = tf2.capabilities()
print(info.game, info.game_id, info.api_version)
print("Four teams:", caps.four_teams, "Civilian:", caps.civilian)
print("Game data available:", tf2.session().data_available)
Check tf2.session().data_available, handle nil and reacquire player/entity tables inside each callback. Map changes, disconnects, an ineligible session or Stop can make game queries empty. Returned tables are copies; editing one does not write game memory.
Stopping a script removes its callbacks and UI. Changes made to built-in settings remain and can be saved in a profile. Raw native hook APIs are not provided by the TF2 extension.
Download the complete host contract, Classified contract or shared UI reference for behavior and limits.