|
| 05 Dec 2015 06:23 PM |
local Blocks = { ["%s(noob)%s"] = "new person", }
for i, v in next, Blocks do Chat = Chat:gsub(i, v) end
So, I have decided that ROBLOX's filter allows for some pretty harsh language. I was making this, but realized it will not work if they say NooB or something, because it will not be lowercase. Is there any way around this? I used to know how, but I am having a brain block. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 06:24 PM |
local Blocks = { ["%s(noob)%s"] = "new person", }
for i, v in next, Blocks do Chat = Chat:lower():gsub(i, v) end |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 06:26 PM |
| Hmm I was thinking that, but that removes their capital letters ;( |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Dec 2015 06:32 PM |
local Bad = { ["noob"] = "new person", }
function Sub(match) if Bad[match:lower()] then return Bad[match:lower()] else return match end end
str = str:gsub("%S+",Sub) |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 06:34 PM |
local Blocks = { ["noob"] = "new person", }
for Key, Block in next, Blocks do for i = 1, #Chat:lower() do if i-#Key == Block then -- Chat[i-#Key] == replace it somehow end end end |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 06:36 PM |
@CHIMMILORD
I don't really understand your code; if you could, explain it.
Also, I am not sure if it does, but I need it to make sure it has some kind of %s character before and after it (so it doesn't mistake if I say like, fasst on accident) and also, I need it to preserve their capital letters. |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Dec 2015 07:24 PM |
local Chat = "yoU NoOb "
local wordsCI = { ["noob"] = "new person", }
for pattern, replacement in pairs(wordsCI) do local i,j = 1, 1 local ChatLower = Chat:lower() repeat i, j = ChatLower:find(pattern, j+1) print(i,j) if not i then break end if not Chat:sub(i-1,i-1):match("[^%s]") and not Chat:sub(j+1,j+1):match("[^%s]") then Chat = Chat:sub(1,i-1)..replacement..Chat:sub(j+1) j = j +(#replacement - (j-i+1)) end print(i, j) until not j print(Chat) end |
|
|
| Report Abuse |
|
|