VERGELua API

engine

Engine queries, commands, tracing, randomness.

engine.GetPlayerInfo(iIndex:number):table

Player info table (name, userid, guid, friendsid, friendsname, fakeplayer, ishltv) or nil.

engine.GetPlayerForUserID(iUserID:number):number

Map an engine user ID to an entity index.

engine.ExecuteCommand(cmd:string)

Execute a console command.

engine.ClientCmd(cmd:string)

Send an unrestricted client command.

engine.GetLevelName():string

Full level name including the map path.

engine.IsPlayingDemo():boolean

Whether a demo is currently playing.

engine.IsTakingScreenshot():boolean

Whether a screenshot is being taken.

engine.Con_IsVisible():boolean

Whether the console is visible.

engine.IsGameUIVisible():boolean

Whether the game UI is visible.

engine.GetMapName():string

Bare map name, for example cp_dustbowl.

engine.GetServerIP():string

Address of the current server.

engine.GetViewAngles():Vector3

Current local view angles.

engine.SetViewAngles(ang:Vector3)

Set local view angles.

engine.PlaySound(path:string)

Play a sound file relative to the game directory.

engine.GetGameDir():string

Game install directory.

engine.SendKeyValues(kv:string):boolean

Send a KeyValues string to the server; false if it fails to parse.

engine.Notification(title:string, long?:string)

Show a notification; long text overrides the title.

engine.RandomSeed(seed:number)

Seed the shared random stream.

engine.RandomFloat(min:number, max?:number):number

Random float in [min, max]; max defaults to 1.

engine.RandomInt(min:number, max?:number):number

Random integer in [min, max]; max defaults to 32767.

engine.RandomFloatExp(min:number, max:number, exp?:number):number

Random float with exponential distribution; exp defaults to 1.

engine.TraceLine(start:Vector3, end:Vector3, mask:number, filter?:function):Trace

Line trace with an optional Lua filter callback.

engine.TraceHull(start:Vector3, end:Vector3, mins:Vector3, maxs:Vector3, mask:number, filter?:function):Trace

Hull trace with an optional Lua filter callback.

engine.GetPointContents(pos:Vector3):number,Entity

Contents mask and the entity at a point, if any.