katsaii / catspeak-lang

A cross-platform modding language for GameMaker games.
https://www.katsaii.com/catspeak-lang/
MIT License
93 stars 6 forks source link

Functions that originate in Catspeak lose the ability to set self/globals structs when passed back into GML #67

Closed JujuAdams closed 1 year ago

JujuAdams commented 1 year ago

Consider

open()
callback(fun() {
    //do stuff
})
close()

On the GML side: open() creates a struct, callback() assigns a callback to that struct, and close() drops the reference to the struct.

In order to get the callback to execute in the intended scope, which would be the created struct, I'd need to call .setSelf() and/or .setGlobals() on the method that Catspeak passes into the bound GML function for callback().

However, this is not possible as it seems like the returned method lacks the necessary setter methods for itself.