katsaii / catspeak-lang

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

Add `is_catspeak` function #98

Closed katsaii closed 1 year ago

katsaii commented 1 year ago

What is your feature request?

Add a is_catspeak function which returns whether a value is a callable Catspeak function or not.

Please describe in detail how you expect this new feature to behave.

Potential implementations (courtesy of @tabularelf):

function is_catspeak(value) {
    return string(value) == "function gml_Script___catspeak_function__";
}
function is_catspeak(value) {
  return is_method(value) && method_get_index(value) == __catspeak_function__; 
}