mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
712 B
25 lines
712 B
=proto
|
|
const char *duk_to_string(duk_context *ctx, int index);
|
|
|
|
=stack
|
|
[ ... val! ... ] -> [ ... ToString(val)! ... ]
|
|
|
|
=summary
|
|
<p>Replace the value at <code>index</code> with an Ecmascript
|
|
<a href="http://www.ecma-international.org/ecma-262/5.1/#sec-9.8">ToString()</a>
|
|
coerced value. Returns a non-<code>NULL</code> pointer to the read-only,
|
|
NUL-terminated string data. If <code>index</code> is invalid, throws an error.</p>
|
|
|
|
<p>Custom type coercion:</p>
|
|
<ul>
|
|
<li>Buffer: coerces byte-for-byte into a string</li>
|
|
<li>Pointer: coerces to a string formatted with <code>sprintf()</code> format
|
|
<code>%p</code></li>
|
|
</ul>
|
|
|
|
=example
|
|
printf("coerced string: %s\n", duk_to_string(ctx, -3));
|
|
|
|
=tags
|
|
stack
|
|
string
|
|
|