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.
 
 
 
 
 
 

37 lines
856 B

name: duk_put_global_string
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
- string
seealso:
- duk_put_global_lstring
- duk_put_global_literal
- duk_put_global_heapptr
introduced: 1.0.0