View Single Post
12-05-14, 09:58 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Resike View Post
I know, but the saved variables force me to do it, and i don't have time to write a proper conversion tool atm.
For a one-time conversion of key names in a saved variables table, you really don't need a "proper conversion tool"... just do it quick and dirty, and don't worry about efficiency, because it doesn't matter in this context:

Code:
local function FindMapID(name)
     for i = 1, 1200 do
          if GetZoneNameByID(i) == name then
               return i
          end
     end
end

for k, v in pairs(db) do
    if type(k) == "string" then
         local id = FindMapID(k)
         if id then
              db[id] = v
              db[k] = nil
         else
              print("ERROR: no mapID found for zone name:", k)
         end
     end
end
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote