diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-09-03 13:14:56 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-09-03 13:14:56 -0300 |
commit | 9db4bfed6bb9d5828c99c0f24749eedf54d70cc2 (patch) | |
tree | 5a7bae2573f3e08813680a2506840f2356d18cd8 /manual | |
parent | 91673a8ec0ae55e188a790bd2dfdc99246adf20e (diff) | |
download | lua-9db4bfed6bb9d5828c99c0f24749eedf54d70cc2.tar.gz lua-9db4bfed6bb9d5828c99c0f24749eedf54d70cc2.tar.bz2 lua-9db4bfed6bb9d5828c99c0f24749eedf54d70cc2.zip |
Revamp of format validation in 'string.format'
When calling 'sprintf', not all conversion specifiers accept all
flags; some combinations are undefined behavior.
Diffstat (limited to 'manual')
-rw-r--r-- | manual/manual.of | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/manual/manual.of b/manual/manual.of index 664b5c1e..ea9a0302 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -7078,8 +7078,10 @@ following the description given in its first argument, | |||
7078 | which must be a string. | 7078 | which must be a string. |
7079 | The format string follows the same rules as the @ANSI{sprintf}. | 7079 | The format string follows the same rules as the @ANSI{sprintf}. |
7080 | The only differences are that the conversion specifiers and modifiers | 7080 | The only differences are that the conversion specifiers and modifiers |
7081 | @T{*}, @id{h}, @id{L}, @id{l}, and @id{n} are not supported | 7081 | @id{F}, @id{n}, @T{*}, @id{h}, @id{L}, and @id{l} are not supported |
7082 | and that there is an extra specifier, @id{q}. | 7082 | and that there is an extra specifier, @id{q}. |
7083 | Both width and precision, when present, | ||
7084 | are limited to two digits. | ||
7083 | 7085 | ||
7084 | The specifier @id{q} formats booleans, nil, numbers, and strings | 7086 | The specifier @id{q} formats booleans, nil, numbers, and strings |
7085 | in a way that the result is a valid constant in Lua source code. | 7087 | in a way that the result is a valid constant in Lua source code. |
@@ -7099,7 +7101,7 @@ may produce the string: | |||
7099 | "a string with \"quotes\" and \ | 7101 | "a string with \"quotes\" and \ |
7100 | new line" | 7102 | new line" |
7101 | } | 7103 | } |
7102 | This specifier does not support modifiers (flags, width, length). | 7104 | This specifier does not support modifiers (flags, width, precision). |
7103 | 7105 | ||
7104 | The conversion specifiers | 7106 | The conversion specifiers |
7105 | @id{A}, @id{a}, @id{E}, @id{e}, @id{f}, | 7107 | @id{A}, @id{a}, @id{E}, @id{e}, @id{f}, |