Lua · Variables · World

vpk

Read files out of the game's VPK archives.

FunctionWhat it does
vpk.read(entry, callback[, source])Reads one file by its exact path, on a worker thread. The callback runs later on the render thread.

#vpk.read

vpk.read(entry, callback[, source])

Reads one file by its exact path, on a worker thread. The callback runs later on the render thread.

Arguments

entrystring
Path inside the VPK, for example panorama/images/icons/equipment/ak47.svg. No .., no :, no leading slash.
callbackfunction(ok, data)
data is the file bytes, or the error text when ok is false.
sourcestringoptional
game (csgo/pak01_dir.vpk, default) or map (the current map's VPK).

Returns

boolean
false when it could not start (bad path, game folder unknown, 4 reads already running).
  • 16 MB per entry. No folder listing; you need the exact path.