читаю у Иерусаличего и в
https://www.lua.org/pil/20.3.html встречаю набор с 3мя %, %%%02X, как это можно понять? В частности
[QUOTE]The corresponding encoding is also easy to write. First, we write the escape function; this function encodes all special characters as a
%´ followed by the character ASCII code in hexadecimal (the format option "%02X" makes an hexadecimal number with two digits, using 0 for padding), and then changes spaces to
+´:
function escape (s)
s = string.gsub(s, "([&=+%c])", function (c)
return string.format ("%%%02X", string.byte©)
end)
s = string.gsub(s, " ", "+")
return s
end
[/QUOTE]
"%%%02X" - что тут означают аж три знака % ?, первый надо понимать экранирующий, но зачем после него еще два знака % а не один? Т.к. сказано что опцией является %02X а не %%02X
И еще вопрос - что делает опция %02X? т.к. в описании к функции format именно такой опции я не встретил:
[QUOTE]string.format (formatstring, ···)
Returns a formatted version of its variable number of arguments following the description given in its first argument (which must be a string). The format string follows the same rules as the printf family of standard C functions. The only differences are that the options/modifiers *, l, L, n, p, and h are not supported and that there is an extra option, q. The q option formats a string in a form suitable to be safely read back by the Lua interpreter: the string is written between double quotes, and all double quotes, newlines, embedded zeros, and backslashes in the string are correctly escaped when written. For instance, the call
string.format('%q', 'a string with "quotes" and \n new line')
will produce the string:
"a string with \"quotes\" and \
new line"
The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument, whereas q and s expect a string.
This function does not accept string values containing embedded zeros, except as arguments to the q option.
[/QUOTE]
Надо понимать что это составная опция из указанных выше, только чтото не совсем пойму как она действует