Development Section > Your Developing Problems

string.gsub with variables



--- Code: Lua ---CurrentMsg[3] = CurrentMsg[3]:gsub(ReplaceWhat[r],ReplaceWith[r]) All i got is just "malformed pattern (missing ']')"
I also tried to replace variables with functions and got "bad argument #2 to 'gsub' (string expected, got function)"

I don't want to use patterns, i want to use variables. Is there anything i can do with that?

Thank you for your answer.
I found that the problem isn't with variables, the problem is with the values of that variables :)

If anyone curious, old values:

--- Code: ---ReplaceWhat = { "[b]","[/b]","[u]","[/u]","[i]","[/i]","[c]","[/c]","[quote]","[/quote]" }
--- End code ---

New values:

--- Code: ---ReplaceWhat = { "%[b]","%[/b]","%[u]","%[/u]","%[i]","%[/i]","%[c]","%[/c]","%[quote]","%[/quote]" }
--- End code ---


[0] Message Index

Go to full version