mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
8 years ago
3 changed files with 35 additions and 4 deletions
@ -1,6 +1,8 @@ |
|||
<div class="note"> |
|||
There is no reliable way to distinguish a zero-size buffer from a non-buffer |
|||
based on the return values. A <code>NULL</code> with zero size is returned for |
|||
a non-buffer. The same values may be returned for a zero-size buffer (although |
|||
it is also possible that a non-<code>NULL</code> pointer is returned). |
|||
based on the return values alone: a <code>NULL</code> with zero size is returned |
|||
for a non-buffer. The same values may be returned for a zero-size buffer (although |
|||
it is also possible that a non-<code>NULL</code> pointer is returned). Use |
|||
<code><a href="#duk_is_buffer_data">duk_is_buffer_data()</a></code> when type |
|||
checking a buffer or a buffer object. |
|||
</div> |
|||
|
@ -0,0 +1,26 @@ |
|||
name: duk_is_buffer_data |
|||
|
|||
proto: | |
|||
duk_bool_t duk_is_buffer_data(duk_context *ctx, duk_idx_t idx); |
|||
|
|||
stack: | |
|||
[ ... val! ... ] |
|||
|
|||
summary: | |
|||
<p>Returns 1 if value at <code>idx</code> is a plain buffer or any |
|||
buffer object type, otherwise returns 0. If <code>idx</code> is invalid, |
|||
also returns 0.</p> |
|||
|
|||
example: | |
|||
if (duk_is_buffer_data(ctx, -3)) { |
|||
/* ... */ |
|||
} |
|||
|
|||
tags: |
|||
- stack |
|||
- buffer |
|||
|
|||
seealso: |
|||
- duk_is_buffer |
|||
|
|||
introduced: 2.0.0 |
Loading…
Reference in new issue