API GetMapZones

From Warcraft Wiki
Jump to navigation Jump to search

Returns the zone IDs and zone names of a specified continent.

zoneID_1, zoneName_1, zoneID_2, zoneName_2, ..., zoneID_N, zoneName_N = GetMapZones(continentIndex);

Arguments

continentIndex
Number - Which continent to fetch the zone list from (continent indexes refer to the result of GetMapContinents()'s string types, halved). Currently the values are 1 for Kalimdor, 2 for Eastern Kingdoms, and 3 is for Outland (without Twisting Nether).

Returns

zoneID(n), zoneName(n) (where n is the zone index)
zoneID_n
Number - The ID of the nth zone within the specified continent (n corresponds to the value GetCurrentMapZone() returns)
zoneName_n
String - The name of the nth zone within the specified continent (n corresponds to the value GetCurrentMapZone() returns)

Details

There are a different number of zones on each continent and these may change without notice as new content is added. Use the name of a zone if you wish to make your code future-proof.
Beware : zone names depend on locale, and zone number too because GetMapZones() returns them in alphabetical order. So french and german clients do not have the zones returned in the same order than english ones, see the table of localized map zones.

Example 1

local function LoadZones(c, ...)
	for i=1,select('#', ...),1 do
		c[i] = select(i,...)
	end
end

local C1 = {}
local C2 = {}
local C3 = {}
local C4 = {}

LoadZones(C1,GetMapZones(1))
LoadZones(C2,GetMapZones(2))
LoadZones(C3,GetMapZones(3))
LoadZones(C4,GetMapZones(4))

Result

The array C1 holds all a list of all zone names for Kalimdor, C2 for Eastern Kingdoms, C3 for Outland, and C4 for Northrend.

Patch changes

  • Warlords of Draenor Patch 6.0.2 (2014-10-14): Added zoneID(n) returns, which are interspersed between every zoneName(n) return.