我正在尝试编写一个WoW的插件(使用lua语言)。它是基于特定单词的聊天过滤器。我无法弄清如何使这些单词的数组不区分大小写,以便任何大小写组合的单词都能匹配数组。如果您有任何想法,将不胜感激。谢谢!
local function wordFilter(self,event,msg)
local keyWords = {"word","test","blah","here","code","woot"}
local matchCount = 0;
for _, word in ipairs(keyWords) do
if (string.match(msg, word,)) then
matchCount = matchCount + 1;
end
end
if (matchCount > 1) then
return false;
else
return true;
end
end