Originally Posted by Keldor
Hi all,
I've another question.
What is the best way to loop through all the zone names of the game?
My Idea was to have Loop with i = 1 to 99999 with this function inside GetZoneNameByIndex(i)
If the return value is not empty, I will push it to my array. This should return all zone names, right?
Keldor
|
I use this:
Lua Code:
local function GetZones()
local i = 1
local zones = data.Zones -- a table of your choice
local zbn = GetZoneNameByIndex
local zone
while true do
zone = zbn(i)
if zone == "" then break end
zones[zone] = i
i = i + 1
end
end
Don't forget: These names a raw, including localization data. You should use zo_strformat for display.