Quantcast

Make comparison only using lowercase letters and no spaces (UTF-8 safety)

Ludovicus [06-25-19 - 22:01]
Make comparison only using lowercase letters and no spaces (UTF-8 safety)
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index e3c6fbb..e0a79e8 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -1267,8 +1267,8 @@ end
 local wrongseparator = "(%d)" .. (tonumber("1.1") and "," or ".") .. "(%d)"
 local rightseparator =   "%1" .. (tonumber("1.1") and "." or ",") .. "%2"

--- Make comparison only lowercase letters and numbers
-local function lowergsub(s) return s:lower():gsub("[^%a%d]", "") end
+-- Make comparison only using lowercase letters and no spaces
+local function lowergsub(s) return s:lower():gsub("[%s]", "") end

 SlashCmdList["TOMTOM_WAY"] = function(msg)
     msg = msg:gsub("(%d)[%.,] (%d)", "%1 %2"):gsub(wrongseparator, rightseparator)