Censoring words in lua
If you care about performance, you should have a look at LPeg. It makes it way easier to handle large numbers of string matching and substitution rules.

For example, you could define patterns and their substitution values like this:

local lpeg = require 'lpeg'

local p = lpeg.P
local bad_word = 
   p"bad" / "good" +
   (p"dumb" + p"stupid") / "$#&amp;*"

local sanitize = lpeg.Cs( (bad_word + p(1))^1 )

print(sanitize:match("this is a bad word"))
print(sanitize:match("python is dumb!"))


Which makes it much easier both to add new entries and to eventually move them into a table or even a separate file.