Fix fuzzy zone matching
James Whitehead II [05-01-11 - 18:11]
Fix fuzzy zone matching
This ensures that 'Icecrown' will match 'Icecrown', whereas 'Icec' will
match both 'Icecrown' and 'Icecrown Citadel'. In short, an exact match
will automatically be accepted.
diff --git a/TomTom.lua b/TomTom.lua
index 3c49ba2..b6704c7 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -1124,7 +1124,11 @@ SlashCmdList["TOMTOM_WAY"] = function(msg)
for name, mapId in pairs(nameToMapId) do
local lname = lowergsub(name)
- if lname:match(lzone) then
+ if lname == lzone then
+ -- We have an exact match
+ matches = {name}
+ break
+ elseif lname:match(lzone) then
table.insert(matches, name)
end
end
@@ -1196,7 +1200,11 @@ SlashCmdList["TOMTOM_WAY"] = function(msg)
for name,mapId in pairs(nameToMapId) do
local lname = lowergsub(name)
- if lname:match(lzone) then
+ if lname == lzone then
+ -- We have an exact match
+ matches = {name}
+ break
+ elseif lname:match(lzone) then
table.insert(matches, name)
end
end