lolcatsareawesome Posted August 1, 2013 Share Posted August 1, 2013 Hello, I've an error by using string.gsub because I want to remplace a string by another one but the script think it's a pattern but I don't want a pattern string. The string that I want to remplace is ")" to " ". With string.find per example, he have an argument for disable the pattern. local theString = "lolcats)are)awesome"; local result = string.gsub(theString, ")", " "); outputChatBox(result) The error that I've is "Invalid pattern capture". Link to comment
arezu Posted August 1, 2013 Share Posted August 1, 2013 From lua website: Some characters, called magic characters, have special meanings when used in a pattern. The magic characters are ( ) . % + - * ? [ ^ $ You can fix that by adding "%" in front of the "magic" character, like this: local result = string.gsub(theString, "%)", " "); Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now