Quantcast

Fixed the parsing of the description part of the slash comman

James Whitehead Ii [03-25-08 - 11:15]
Fixed the parsing of the description part of the slash comman
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index 7ec1cd1..9008192 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -725,11 +725,12 @@ end

 SLASH_WAY1 = "/way"
 SlashCmdList["WAY"] = function(msg)
-	msg = msg:lower()
-
 	local tokens = {}
 	for token in msg:gmatch("%S+") do table.insert(tokens, token) end

+	-- Lower the first token
+	tokens[1] = tokens[1]:lower()
+
 	if tokens[1] == "reset" then
 		if tokens[2] == "all" then
 			StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM")
@@ -776,6 +777,7 @@ SlashCmdList["WAY"] = function(msg)
 	elseif tokens[1] and not tonumber(tokens[1]) then
 		-- This is a waypoint set, with a zone before the coords
 		local zone,x,y,desc = unpack(tokens)
+		if desc then desc = table.concat(tokens, " ", 4) end

 		-- Find a fuzzy match for the zone
 		local matches = {}
@@ -811,6 +813,9 @@ SlashCmdList["WAY"] = function(msg)
 		elseif not y or not tonumber(y) then
 			return usage()
 		end
+		if desc then
+			desc = table.concat(tokens, " ", 3)
+		end

 		x = tonumber(x)
 		y = tonumber(y)