Lua functions

GetSpawnByLocationID

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

Historical signature: GetSpawnByLocationID(zone, location_id)

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

Function: GetSpawnByLocationID(zone, location_id)

Description: Selects a currently registered spawn matching the zone's spawn location ID. Unlike the group lookup, the actor need not be alive. The current location ID is checked again after acquiring the actor; retired actors cannot enter a fresh lookup.

The selected original actor has an operation loan before it is exported. The protected Lua invocation retains it through later callbacks and ordinary Lua error return. A reused runtime ID cannot retarget an already returned userdata. Stored userdata is weak between invocations, and later lookups select current zone membership.

Parameters:

  • zone (Zone) - Zone to search.
  • location_id (uint32) - Spawn location ID; zero has no match.

Returns: Spawn userdata, or no value (nil when assigned) if no matching actor can be acquired.

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 Spawn1 = GetSpawnByLocationID(zone, 133782082)

Evidence: server/SpawnScripts/antonica/afociofdecayA.lua:42; binding EQ2Emu_lua_GetSpawnByLocationID.

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