[-0, +1, m]
const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
Pushes onto the stack a formatted string
and returns a pointer to this string.
It is similar to the C function sprintf,
but has some important differences:
-
You do not have to allocate space for the result:
the result is a Lua string and Lua takes care of memory allocation
(and deallocation, through garbage collection).
-
The conversion specifiers are quite restricted.
There are no flags, widths, or precisions.
The conversion specifiers can only be
'
%%' (inserts a '%' in the string),
'%s' (inserts a zero-terminated string, with no size restrictions),
'%f' (inserts a lua_Number),
'%p' (inserts a pointer as a hexadecimal numeral),
'%d' (inserts an int), and
'%c' (inserts an int as a character).
|