2016-12-16 6 views
0

はので、私はLUAで平凡だけど、私はちょうどこの冒涜フィルターのLua

local profanitywords = {"fuck", "shit", "ass"} -- a small list 
local input = io.read() 

for i,v in ipairs (profanitywords) do 
    if string.find(input:lower(), v) then 
     print("Profanity") 
    else 
     print("Not Profanity") 
    end 
end 

しかし、私は、出力で取得で遊んでたことはこれですゼロブランスタジオを使用して

と入力するときに、私は別のものを入力すると、まったく動作しません。助けて?

+2

どのような出力を期待していますか? –

答えて

1
local profanity 
for i,v in ipairs (profanitywords) do 
    if string.find(input:lower(), v) then 
     profanity = true 
     break 
    end 
end 

if profanity then 
    print("Profanity") 
else 
    print("Not Profanity") 
end