From 5519d0b9c15b9bf43c55f93c0de39db1ebeebd15 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Tue, 1 Mar 2011 16:50:43 +0000 Subject: [PATCH] Fix descriptions in /way command --- TomTom.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index 74b5ad9..bd593ca 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -1159,6 +1159,14 @@ SlashCmdList["TOMTOM_WAY"] = function(msg) end end elseif tokens[1] and not tonumber(tokens[1]) then + -- Example: /way Elwynn Forest 34.2 50.7 Party in the forest! + -- tokens[1] = Elwynn + -- tokens[2] = Forest + -- tokens[3] = 34.2 + -- tokens[4] = 50.7 + -- tokens[5] = Party + -- ... + -- -- Find the first numeric token local zoneEnd for idx = 1, #tokens do @@ -1167,6 +1175,7 @@ SlashCmdList["TOMTOM_WAY"] = function(msg) -- We've encountered a number, so the zone name must have -- ended at the prior token zoneEnd = idx - 1 + break end end @@ -1176,8 +1185,8 @@ SlashCmdList["TOMTOM_WAY"] = function(msg) end -- This is a waypoint set, with a zone before the coords - local zone = table.concat(tokens, " ", 1, zoneEnd - 1) - local x,y,desc = select(zoneEnd, unpack(tokens)) + local zone = table.concat(tokens, " ", 1, zoneEnd) + local x,y,desc = select(zoneEnd + 1, unpack(tokens)) if desc then desc = table.concat(tokens, " ", zoneEnd + 3) end -- 1.7.9.5