Skip to content
Discussion options

You must be logged in to vote

Use xsCallFunction* to call a function when you have a function object. Use xsCall*, by contrast, to call a method of an object by name.

This JavaScript...

this.foo(101)

...is implemented in C using xsCall* to call the foo method of this:

xsCall1(xsThis, xsID_foo, xsInteger(101));

This JavaScript...

let foo = ...; // get the function object into "foo" as appropriate 
foo.call(this, 101);

...is implemented in C using xsCallFunction* to call the function foo with a receiver of this:

// get the function object into "xsVar(0)" as appropriate
xsCallFunction1(xsVar(0), xsThis, xsInteger(101));

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by phoddie
Comment options

You must be logged in to vote
3 replies
@phoddie
Comment options

@rmontrosecbw
Comment options

@rmontrosecbw
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants