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.
33 lines
897 B
33 lines
897 B
name: duk_to_lstring
|
|
|
|
proto: |
|
|
const char *duk_to_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len);
|
|
|
|
stack: |
|
|
[ ... val! ... ] -> [ ... ToString(val)! ... ]
|
|
|
|
summary: |
|
|
<p>Replace the value at <code>idx</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, and writes the string byte length to <code>*out_len</code>
|
|
(if <code>out_len</code> is non-<code>NULL</code>). If <code>idx</code> is invalid, throws
|
|
an error.</p>
|
|
|
|
<div include="ref-custom-type-coercion.html" />
|
|
|
|
example: |
|
|
const char *ptr;
|
|
duk_size_t sz;
|
|
|
|
ptr = duk_to_lstring(ctx, -3, &sz);
|
|
printf("coerced string: %s (length %lu)\n", ptr, (unsigned long) sz);
|
|
|
|
tags:
|
|
- stack
|
|
- string
|
|
|
|
seealso:
|
|
- duk_safe_to_lstring
|
|
|
|
introduced: 1.0.0
|
|
|