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
713 B
33 lines
713 B
=proto
|
|
duk_bool_t duk_put_global_string(duk_context *ctx, const char *key);
|
|
|
|
=stack
|
|
[ ... val! ] -> [ ... ]
|
|
|
|
=summary
|
|
<p>Put property named <code>key</code> to the global object.
|
|
Return value behaves similarly to
|
|
<code><a href="#duk_put_prop">duk_put_prop()</a></code>.
|
|
This is a convenience function which does the equivalent of:</p>
|
|
<pre class="c-code">
|
|
duk_bool_t ret;
|
|
|
|
duk_push_global_object(ctx);
|
|
duk_insert(ctx, -2);
|
|
ret = duk_put_prop_string(ctx, -2, key);
|
|
duk_pop(ctx);
|
|
/* 'ret' would be the return value from duk_put_global_string() */
|
|
</pre>
|
|
|
|
=example
|
|
duk_push_string(ctx, "1.2.3");
|
|
(void) duk_put_global_string(ctx, "my_app_version");
|
|
|
|
=tags
|
|
property
|
|
|
|
=seealso
|
|
duk_get_global_string
|
|
|
|
=introduced
|
|
1.0.0
|
|
|