Lua functions

GetZone

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

Historical signature: GetZone(zone_id|zone_name|spawn)

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

Function: GetZone(zone_id|zone_name|spawn)

Description: Gets the zone object by the zone_id

Parameters:

  • zone_id, zone_name, spawn (uint32/string/spawn) - Integer/String/Spawn value zone_id or zone_name or spawn.

Returns: A weak Zone userdata value for the zone obtained or created by ID/name, or for a supplied spawn's current zone. Returns no value (Lua nil) when no scene is available. Saving this value does not keep the zone alive.

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

Evidence: server/SpawnScripts/antonica/afociofdecayA.lua:22; binding EQ2Emu_lua_GetZone.

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