Name Blacklist [string.find error]

I am creating a blacklisted of characters that can be found in your name. If it is found, you are kicked from the server.
[lua]local nameblacklist = {
“%”,
}
for _,v in pairs(nameblacklist) do
if string.find(string.lower(ply:Nick()), v) then --line 83
ply:Kick(“Blacklisted character in name : “…v…”.”)
end
end
[/lua]

Error


Hook 'InitialSpawnStuff' Failed: [@gamemodes\b\gamemode\init.lua:83] malformed pattern (ends with '%')

Any help would be appericiated to solving the error.

One thing I see is that your table has 1 object in it but has a comma at the end, suggesting to Lua that there is additional objects. I’m not sure if that’s because you cut things out or if it’s just a silly mistake.

Lua doesn’t care about the comma at the end of your table.

O.o Really? I’ve gotten errors for that before… If so, I feel stupid now, lol.

I found a thread about this (on a different forum), apparently you have to use %% instead of %.

(Though, both % and ~ characters are removed from a player’s name, so you shouldn’t ever have to search for either of those how you’re doing it.)

The solution was “%%”, but you’re right, they’re removed from Nick() anyway.