Lua functions

GetGroup

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

Historical signature: GetGroup(Spawn)

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

Function: GetGroup(spawn)

Description: For a Player with membership information, returns the connected local Players in its original group. For other spawns with a spawn group, returns members whose actor borrow admission remains open. Peer-only player-group records do not contribute local actors. A valid membership whose group is unavailable may produce an empty table; invalid input or no matching membership returns no value.

Membership records, group allocations and returned actors have explicit operation custody. ID/address reuse cannot substitute another allocation. Spawn-group membership owns shared state containing weak references to the original actors. Membership and its revision are copied under the topology lock; reclamation-owned actor loans are acquired after that lock is released. Retired actors and constructions without a reclamation owner are omitted. A previously returned snapshot remains valid after regrouping or retirement. Player-group collection releases its read lock on C++ allocation failure. Returned loans enter the current Lua invocation before userdata is pushed, keeping admitted actors readable through callbacks/retirement in that invocation. Stored userdata remains weak between calls.

Parameters:

  • spawn (Spawn) - Player or spawn whose group is requested.

Returns: One-based table of Spawn userdata, possibly empty, or no value (nil when assigned).

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 = GetGroup(NPC)

Evidence: server/SpawnScripts/Generic/NPCModule.lua:361; binding EQ2Emu_lua_GetGroup.

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