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.
31 lines
639 B
31 lines
639 B
11 years ago
|
=proto
|
||
11 years ago
|
duk_idx_t duk_push_object(duk_context *ctx);
|
||
11 years ago
|
|
||
|
=stack
|
||
|
[ ... ] -> [ ... obj! ]
|
||
|
|
||
|
=summary
|
||
10 years ago
|
<p>Push an empty object to the stack. Returns non-negative index (relative
|
||
|
to stack bottom) of the pushed object.</p>
|
||
|
|
||
|
<p>The internal prototype of the created object is <code>Object.prototype</code>.
|
||
|
Use <code><a href="#duk_set_prototype">duk_set_prototype()</a></code> to change it.</p>
|
||
11 years ago
|
|
||
|
=example
|
||
11 years ago
|
duk_idx_t obj_idx;
|
||
11 years ago
|
|
||
11 years ago
|
obj_idx = duk_push_object(ctx);
|
||
11 years ago
|
duk_push_int(ctx, 42);
|
||
|
duk_put_prop_string(ctx, obj_idx, "meaningOfLife");
|
||
|
|
||
|
/* object is now: { "meaningOfLife": 42 } */
|
||
|
|
||
|
duk_pop(ctx); /* pop object */
|
||
|
|
||
11 years ago
|
=tags
|
||
|
stack
|
||
|
object
|
||
10 years ago
|
|
||
|
=introduced
|
||
|
1.0.0
|