diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-03-13 14:04:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-03-13 14:04:01 -0300 |
commit | dfebe439db76b5c9fd9b4e3877857e2449c8ad87 (patch) | |
tree | c31aa85dc53d1c0e0704060f313b682765dd459c /manual | |
parent | cf71a5ddc742692fad813f89f1c9ef53e1ffde0f (diff) | |
download | lua-github-dfebe439db76b5c9fd9b4e3877857e2449c8ad87.tar.gz |
New conversion specifier '%p' for 'string.format'
The call 'string.format("%p", val)' gives a Lua equivalent to the
C API function 'lua_topointer'.
Diffstat (limited to 'manual')
-rw-r--r-- | manual/manual.of | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/manual/manual.of b/manual/manual.of index 9c8ab033..2eb8773f 100644 --- a/manual/manual.of +++ b/manual/manual.of @@ -6751,8 +6751,7 @@ 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 @ANSI{sprintf}. The only differences are that the conversion specifiers and modifiers -@T{*}, @id{h}, @id{L}, @id{l}, @id{n}, -and @id{p} are not supported +@T{*}, @id{h}, @id{L}, @id{l}, and @id{n} are not supported and that there is an extra specifier, @id{q}. The specifier @id{q} formats booleans, nil, numbers, and strings @@ -6791,6 +6790,14 @@ it is converted to one following the same rules of @Lid{tostring}. If the specifier has any modifier, the corresponding string argument should not contain @x{embedded zeros}. +The specifier @id{p} formats the pointer +returned by @Lid{lua_topointer}. +That gives a unique string identifier for tables, userdata, +threads, strings, and functions. +For other values (numbers, nil, booleans), +this specifier results in a string representing +the pointer @id{NULL}. + } @LibEntry{string.gmatch (s, pattern [, init])| @@ -8768,7 +8775,7 @@ address space.) } @item{ -The constant @Lid{LUA_ERRGCMM} was removed. +The constant @id{LUA_ERRGCMM} was removed. Errors in finalizers are never propagated; instead, they generate a warning. } |