=proto const char *duk_get_lstring(duk_context *ctx, int index, size_t *out_len); =stack [ ... val! ... ] =summary

Get character data pointer and length for a string at index without modifying or coercing the value. Returns a non-NULL pointer to the read-only, NUL-terminated string data, and writes the string byte length to *out_len (if out_len is non-NULL). Returns NULL and writes zero to *out_len (if out_len is non-NULL) if the value is not a string or the index is invalid.

To get the string character length (instead of byte length), use duk_get_length().

A non-NULL return value is guaranteed even for zero length strings; this differs from how buffer data pointers are handled (for technical reasons).
=example const char *buf; size_t len; buf = duk_get_lstring(ctx, -3, &len); if (buf) { printf("value is a string, %d bytes\n", (int) len); } =tags stack