【发布时间】:2011-11-10 22:39:17
【问题描述】:
我正在尝试为 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
【问题讨论】: