Lua functions

GetSpawnByGroupID

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

Historical signature: GetSpawnByGroupID(zone, group_id)

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

Function: GetSpawnByGroupID(zone, group_id)

Description: Selects the first living, currently registered spawn matching the zone's database group ID. The current group ID is checked again after acquiring the actor. Multiple independent runtime groups can share this template ID; this function does not merge them.

The selected original actor has an operation loan before it is exported. The current protected Lua invocation retains that loan, so retirement during that invocation does not replace it with another actor under a reused ID. Stored userdata remains weak between invocations; a later lookup selects from current zone membership.

Parameters:

  • zone (Zone) - Zone to search.
  • group_id (uint32) - Database spawn group ID; zero has no match.

Returns: Spawn userdata, or no value (nil when assigned) if no living 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 group = GetSpawnByGroupID(zone, 1049684)

Evidence: server/SpawnScripts/The Sepulcher of Jahnda/RonicustheRed.lua:28; binding EQ2Emu_lua_GetSpawnByGroupID.

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