This PR introduces catspeak_get_self and catspeak_get_index, which play as counterparts to method_get_self and method_get_index. The reason for this is that method_get_index will return __catspeak_function__ or __catspeak_method__ from Catspeak programs. And even then, not as a method but as a GML function index. That's likely to cause all sorts of issues.
method_get_self also has the unfortunate issue where it could return the Catspeak program struct itself. Which may also be unintended depending on who you ask.
catspeak_get_index resolves this by always returning a method. Never a function ID. This means that any Catspeak functions or Catspeak methods, will always return their callee program "as is". And any GML function will be returned as a method with a bound to undefined.
catspeak_get_self resolves this by returning self from only GML functions and Catspeak methods. Anything marked as a Catspeak function (via is_catspeak) will retrieve self_ via accessor (if it exists), or returns undefined.
This PR introduces
catspeak_get_self
andcatspeak_get_index
, which play as counterparts tomethod_get_self
andmethod_get_index
. The reason for this is thatmethod_get_index
will return__catspeak_function__
or__catspeak_method__
from Catspeak programs. And even then, not as a method but as a GML function index. That's likely to cause all sorts of issues.method_get_self
also has the unfortunate issue where it could return the Catspeak program struct itself. Which may also be unintended depending on who you ask.catspeak_get_index
resolves this by always returning a method. Never a function ID. This means that any Catspeak functions or Catspeak methods, will always return their callee program "as is". And any GML function will be returned as a method with a bound toundefined
.catspeak_get_self
resolves this by returning self from only GML functions and Catspeak methods. Anything marked as a Catspeak function (viais_catspeak
) will retrieveself_
via accessor (if it exists), or returnsundefined
.