[jsextensions c-api] Max object used as a JavaScript class: passing this.patcher as parameter

cesc's icon

I am working with the jsextensions c-api, the only example I know of is in the max-sdk (simplejs)

Passing this patcher as parameter in javascript gets interpreted as two parameters (jsobject and an integer) but in javascript I am passing obviously only one parameter.

- m.doEvilThingsWith(1) has one parameter and ac's value in c is one
- m.doEvilThingsWith(this.patcher) has one parameter but ac's value in c is two, is this intended or am I missing something?

Here you have the whole example

When I uncomment the line after BOOM, it crashes because I am not correctly getting the pointer to the patcher, any ideas on how to achieve that?

See below the relevant c code part.