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.
 
 
 
 
 
 

32 lines
798 B

name: duk_get_buffer_data_default
proto: |
void *duk_get_buffer_data_default(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len);
stack: |
[ ... val! ... ]
summary: |
<p>Like <code><a href="#duk_get_buffer_data">duk_get_buffer_data()</a></code>
but with an explicit default value, returned when the value is not a plain
buffer, a buffer object, or the index is invalid.</p>
<div include="default-pointer-validity.html" />
example: |
void *ptr;
duk_size_t sz;
char buf[256];
/* Use a buffer or buffer object given at index 2, or default to 'buf'. */
ptr = duk_get_buffer_data_default(ctx, 2, &sz, (void *) buf, sizeof(buf));
tags:
- stack
- buffer
seealso:
- duk_get_buffer_data
- duk_get_buffer_default
introduced: 2.1.0