AllJoyn/Samples/AllJoyn.JS/External/duktape/src-separate/duk_api_stack.c
duk_hobject *duk_get_hobject_or_lfunc_coerce(duk_context *ctx, duk_idx_t index) {
	duk_tval *tv;

	DUK_ASSERT_CTX_VALID(ctx);

	tv = duk_require_tval(ctx, index);
	DUK_ASSERT(tv != NULL);
	if (DUK_TVAL_IS_OBJECT(tv)) {
		return DUK_TVAL_GET_OBJECT(tv);
	} else if (DUK_TVAL_IS_LIGHTFUNC(tv)) {
		duk_to_object(ctx, index);
		return duk_require_hobject(ctx, index);
	}

	return NULL;
}
/* Useful for internal call sites where we either expect an object (function)
 * or a lightfunc.  Accepts an object (returned as is) or a lightfunc (coerced
 * to an object).  Return value is NULL if value is neither an object nor a
 * lightfunc.
 */
Useful for internal call sites where we either expect an object (function)
or a lightfunc.  Accepts an object (returned as is) or a lightfunc (coerced
to an object).  Return value is NULL if value is neither an object nor a
lightfunc.
Useful for internal call sites where we either expect an object ( function ) or a lightfunc . Accepts an object ( returned as is ) or a lightfunc ( coerced to an object ) . Return value is NULL if value is neither an object nor a lightfunc .
duk_hobject *duk_get_hobject_or_lfunc_coerce(duk_context *ctx, duk_idx_t index) {
	duk_tval *tv;
	DUK_ASSERT_CTX_VALID(ctx);
	tv = duk_require_tval(ctx, index);
	DUK_ASSERT(tv != NULL);
	if (DUK_TVAL_IS_OBJECT(tv)) {
		return DUK_TVAL_GET_OBJECT(tv);
	} else if (DUK_TVAL_IS_LIGHTFUNC(tv)) {
		duk_to_object(ctx, index);
		return duk_require_hobject(ctx, index);
	}
	return NULL;
}
duk_hobject * duk_get_hobject_or_lfunc_coerce ( duk_context * ctx , duk_idx_t index ) { duk_tval * tv ; DUK_ASSERT_CTX_VALID ( ctx ) ; tv = duk_require_tval ( ctx , index ) ; DUK_ASSERT ( tv != NULL ) ; if ( DUK_TVAL_IS_OBJECT ( tv ) ) { return DUK_TVAL_GET_OBJECT ( tv ) ; } else if ( DUK_TVAL_IS_LIGHTFUNC ( tv ) ) { duk_to_object ( ctx , index ) ; return duk_require_hobject ( ctx , index ) ; } return NULL ; }
Useful for internal call sites where we either expect an object (function)
 or a lightfunc.
Useful for internal call sites where we either expect an object ( function ) or a lightfunc .