I have a string I need to add a variable to so I use the string.format
method, but the string also contains the symbol "%20"
(not sure what it represents, probably a white space or something). Anyway since the string contains multiple "%"
and I only want to add the variable to the first one to set the id, is there a way to escape the string at the points or something?
As it is now:
ID = 12345
string.format("id=%s&x=foo=&bar=asd%20yolo%20123-1512", ID)
I get bad argument #3 to 'format' (no value).
error -- since it expects 3 variables to be passed.
You can escape a %
with another %
, e.g. string.format("%%20")
will give %20