Quick actions

cmd+k|ctrl+k

Navigation

Languages

chat filter

Snippet info

Language

Lua

Visibility

public

Author

techhog

Created

2021-05-25T12:54:37.629472Z

Updated

2021-05-25T12:54:37.629472Z

--yes this was made by me i uploaded signed out on accident
local filter = {'gay','retarded','gahy','retarhded'}

function string.split(str, sep) 
    if sep == nil then 
        sep = '%20'
    end
    local length = #str
    local return_ = {}
    if sep == '%20' then 
        for i = 1,length do 
            table.insert(return_, string.sub(str, i, i))
        end 
    else
        for a in string.gmatch(str, "([^"..sep.."]+)") do
            table.insert(return_, a)
        end
        return return_
    end
    return return_
end

function table.find(t, v)
    for a,b in pairs(t) do 
        if b then
            if b == v then
                return b 
            end
        end
    end
end 

function chat(user,m)
    local return_ = '<'..user..'> '..m
    for a,filtered in pairs(filter) do 
        local hashtags = ''
        for i = 1,#filtered do
            hashtags = hashtags .. '#'
        end
        return_ = string.gsub(return_, string.lower(filtered), hashtags)
        return_ = string.gsub(return_, string.upper(filtered), hashtags)
    end
    for a,b in pairs(string.split(return_, ' ')) do 
        if b then
            local hashtags = ''
            for i = 1,#b do
                hashtags = hashtags .. '#'
            end
            if table.find(filter, string.lower(b)) or table.find(filter, string.upper(b)) then
                return_ = string.gsub(return_, b, hashtags) 
            end 
        end 
    end 
    print(return_)
end 

local message = 'Hey! You are GaY and RetArded'
chat('Chat Filter',message)
INFO