문제

SpiderMonkey에서 C 코드 내에서 JSObject의 속성 값을 어떻게 가져오나요?

static JSBool
JSD_getter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
    jsval js_id;
    JS_GetProperty(cx, obj, "id", &js_id); // js_id has JavaScript type
    int c_id;
    JS_ValueToInt32(cx, js_id, &c_id); // Now, c_id contains the actual value
}                                      // of obj.id, as a C native type
도움이 되었습니까?

해결책

JS_GetProperty()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top