Closed jockm closed 4 months ago
For 1) you can use JS_IsObject
, but you probably don't need to do that and go straight for checking for properties.
You can do that with JS_GetPropertyStr
like so: `JSValue prop = JS_GetPropertyStr(ctx, obj, "a");
Setting a new property can be done like so: JS_SetPropertyStr(ctx, obj, "result", JS_NewInt32(ctx, 3)
@saghul Thank you so very much!
Forgive me if this is in the documentation, but I couldn't seem to find it. Imaging I have the following Javascript:
and I want to call a native function called
MyCFunction
that takesfoo
as an argument, readsa
andb
, adds them together, and then puts the result intoresult
, such thatfoo
would now be:How do I:
Any guidance would be appreciated