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.

36 lines
956 B

name: duk_to_object
proto: |
void duk_to_object(duk_context *ctx, duk_idx_t idx);
stack: |
[ ... val! ... ] -> [ ... ToObject(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.9">ToObject()</a>
coerced value. There is no return value. Throws an error if value at
<code>idx</code> is not
<a href="http://www.ecma-international.org/ecma-262/5.1/#sec-9.10">object coercible</a>,
or if <code>idx</code> is invalid.</p>
<p>The following types are not object coercible:</p>
<ul>
<li><code>undefined</code></li>
<li><code>null</code></li>
</ul>
<p>Custom type behavior: see
<a href="http://duktape.org/guide.html#typealgorithms">Type algorithms</a>.
Note in particular that plain buffer values coerce into equivalent
Uint8Array objects.</p>
example: |
duk_to_object(ctx, -3);
tags:
- stack
- object
introduced: 1.0.0