From 9db4bfed6bb9d5828c99c0f24749eedf54d70cc2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 3 Sep 2021 13:14:56 -0300 Subject: Revamp of format validation in 'string.format' When calling 'sprintf', not all conversion specifiers accept all flags; some combinations are undefined behavior. --- manual/manual.of | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'manual/manual.of') 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, which must be a string. The format string follows the same rules as the @ANSI{sprintf}. The only differences are that the conversion specifiers and modifiers -@T{*}, @id{h}, @id{L}, @id{l}, and @id{n} are not supported +@id{F}, @id{n}, @T{*}, @id{h}, @id{L}, and @id{l} are not supported and that there is an extra specifier, @id{q}. +Both width and precision, when present, +are limited to two digits. The specifier @id{q} formats booleans, nil, numbers, and strings in a way that the result is a valid constant in Lua source code. @@ -7099,7 +7101,7 @@ may produce the string: "a string with \"quotes\" and \ new line" } -This specifier does not support modifiers (flags, width, length). +This specifier does not support modifiers (flags, width, precision). The conversion specifiers @id{A}, @id{a}, @id{E}, @id{e}, @id{f}, -- cgit v1.2.3-55-g6feb