Lua functions

GetDistance

Registered in this checkout as EQ2Emu_lua_GetDistance; implementation found at WorldServer/Lua/LuaFunctions.cpp:3769.

Historical signature: GetDistance(spawn, spawn2, include_radius)

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: GetDistance(spawn, spawn2, include_radius)

Description: Gets the distance between the two spawns, spawn and spawn2. The include_radius is optional when set to true will use the collision radius of the spawn to reduce distance of the spawns.

Parameters:

  • spawn (Spawn) - Spawn object representing spawn.
  • spawn2 (Spawn) - Spawn object representing spawn2.
  • include_radius (uint8) - Distance include_radius. Returns: None.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

local Distance = GetDistance(NPC,Cat,1)

Evidence: server/SpawnScripts/BeggarsCourt/arat.lua:30; binding EQ2Emu_lua_GetDistance.

Current registration: WorldServer/Lua/LuaInterface.cpp. Historical explanation: EQ2Emu Lua documentation.