=proto void *duk_to_pointer(duk_context *ctx, int index); =stack [ ... val! ... ] -> [ ... pointer(val)! ... ] =summary

Replaces the value at index with a pointer-coerced value. Returns the resulting void * value. If index is invalid, throws an error.

Coercion rules:

This API call is really only useful for debugging. Note in particular that the pointer returned must not be accessed, as it points to an internal heap header. This is the case even for string/buffer values: the returned pointer differs from the one returned by duk_get_string() and duk_get_buffer().
=example /* Don't dereference the pointer. */ printf("coerced pointer: %p\n", duk_to_pointer(ctx, -3)); =tags stack