Lua functions

GetPlayersInZone

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

Historical signature: GetPlayersInZone(Zone)

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

Function: GetPlayersInZone(Zone)

Description: Returns the player spawns captured from the specified zone.

Parameters:

  • Zone (Zone) — The zone to inspect, such as the value returned by GetZone(NPC).

Returns: A Lua table containing a consecutive, 1-based array of player spawns. Returns no value (nil) if the zone is invalid or no players are captured. The table can be empty if all captured players leave or change sessions while the result is being prepared.

Behavior: Each result refers to the original player captured for that call. A player whose zone, connection or session changes during result preparation is omitted; the function does not substitute a replacement player. The result is a snapshot, so later joins are available on a later call. Player references can become stale after the call as players leave.

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 players = GetPlayersInZone(zone)

Evidence: server/SpawnScripts/BloodSkullValleyMaulicsStronghold/GeneralDrull.lua:41; binding EQ2Emu_lua_GetPlayersInZone.

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