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.
30 lines
637 B
30 lines
637 B
name: duk_require_lstring
|
|
|
|
proto: |
|
|
const char *duk_require_lstring(duk_context *ctx, duk_idx_t idx, duk_size_t *out_len);
|
|
|
|
stack: |
|
|
[ ... val! ... ]
|
|
|
|
summary: |
|
|
<p>Like <code><a href="#duk_get_lstring">duk_get_lstring()</a></code>,
|
|
but throws an error if the value at <code>idx</code> is not a string
|
|
or if the index is invalid.</p>
|
|
|
|
<div include="string-non-null-zero-length.html" />
|
|
|
|
example: |
|
|
const char *buf;
|
|
duk_size_t len;
|
|
|
|
buf = duk_require_lstring(ctx, -3, &len);
|
|
printf("value is a string, %lu bytes\n", (unsigned long) len);
|
|
|
|
tags:
|
|
- stack
|
|
- string
|
|
|
|
seealso:
|
|
- duk_require_string
|
|
|
|
introduced: 1.0.0
|
|
|