wolfhacklua API 1.1 Forum

Game data

Scripts never read the game themselves. The overlay reads the game for its own features and hands each script copies of the result through data.snapshot(). Scripts get values (numbers, strings, tables), never addresses or pointers. (The mem module is the separate, permissioned way to read raw memory.)

data, media and theme are always available; no permission is needed.

The snapshot#

lua
events.on("draw", function()
  local snap = data.snapshot()
  if not snap.in_game then return end

  local me = snap["local"]                 -- "local" is a Lua keyword: index it as a string
  if me then
    draw.text(20, 20, 0xFFFFFFFF, "health " .. me.health .. "  map " .. snap.map)
  end

  for _, p in ipairs(snap.players) do
    if not p.teammate then
      draw.text(20, 40, 0xFF8080FF, p.name .. "  " .. math.floor(p.distance) .. " m")
    end
  end
end)

The snapshot is built once per frame and the same table is returned by every call in that frame, so calling data.snapshot() in several places is free. Do not modify it.

Fields: frame, time, in_game, map, menu_open, fps, frame_ms, screen, local, players, bomb, items and projectiles. Every field is described on the data page.

Why a player list can be empty#

This is the most common surprise:

  • Players come from the ESP. The list contains the players of the teams whose ESP is switched on in the overlay's menu. With enemy ESP off you see no enemies.
  • Flags depend on the ESP's settings. scoped, flashed, defusing, reloading, helmet, kit and has_bomb are true only when the ESP reads them; a false can mean "not read".
  • items and projectiles are absent when empty, so check before looping: for _, it in ipairs(snap.items or {}) do ... end.
  • local is absent when there is no local player (menus, loading).

Positions and units#

World positions are in game units (x, y, z); z of a player is the height of their feet. distance is in metres. Use data.world_to_screen to turn a world position into screen pixels; it returns nil for a point behind the camera.

Events#

EventWhen
ingame(bool)A match was entered or left.
map(name)A different map was loaded.
bomb("planted" | "gone")The bomb was planted, or is no longer planted.
lua
events.on("map", function(name) log.info("now on " .. name) end)

These events fire on changes only, not at load. To learn the current state when your script starts, read it from the snapshot on your first frame: events.once("frame", function() local s = data.snapshot(); log.info(s.in_game, s.map) end).

The bomb table in the snapshot carries the time left (seconds), the site, and the defuse state (defusing, defuse_remaining, defuse_length).

What the data is not#

It is not live memory. It is what the overlay read a moment ago, and it is limited to what the overlay already reads: there are no bones, weapons lists, per-hitbox data, or game events like "player hurt". The gaps page lists what is missing.

API 1.1 · source docs-src/pages/guide/game-data.md