generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Filter not filtering lowercase/uppercase

Previous Thread :: Next Thread 
Smeers is not online. Smeers
Joined: 14 Feb 2013
Total Posts: 797
09 Jul 2016 12:43 PM
local filter = {
['wordtofilter'] = "wordtoreplaceitwith",
}

local function filterText(Text)
for Word,Replacement in next, filter do
Text = Text:gsub(Word,Replacement)
end
return Text
end

This function works to filter specified words into different words as a replacement.

In this case, it would replace the message "wordtofilter" to "wordtoreplaceitwith".

But if someone entered "WORDtoFILTER", it would still return "WORDtoFILTER".

Could someone solve this for me? I don't think I can use gsub and I'm not too good with string manipulation.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2016 12:44 PM
Text = Text:gsub(Word:lower(),Replacement)
Report Abuse
Smeers is not online. Smeers
Joined: 14 Feb 2013
Total Posts: 797
09 Jul 2016 12:46 PM
This makes the word in the table lowercase, thus doing nothing (even if I made it uppercase).

Anyone have a working method?
Report Abuse
Smeers is not online. Smeers
Joined: 14 Feb 2013
Total Posts: 797
09 Jul 2016 12:48 PM
I could actually loop through each string finding each and every uppercase/lowercase combonation and include it in the filtering table automatically with a for loop, but this would cause at least a second delay in sending chat messages in my custom chat (which is what this is for).
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2016 12:50 PM
Oh my bad

Text = Text:lower():gsub(Word,Replacement)


lol
Report Abuse
Smeers is not online. Smeers
Joined: 14 Feb 2013
Total Posts: 797
09 Jul 2016 12:52 PM
Wouldn't that make every single character in the message a lowercase character? :/
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2016 12:53 PM
Well obviously. That's how you filter.

The only other way would to be loop over every word but I cbb to write the code for that since this way is so much easier
Report Abuse
Smeers is not online. Smeers
Joined: 14 Feb 2013
Total Posts: 797
09 Jul 2016 12:55 PM
I'll just make a function that automatically finds all character combonations of uppercase/lowercase and add that to the list on server boot.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2016 12:59 PM
Looping over all the words would be easier
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image