katsaii / catspeak-lang

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

Add `is_catspeak` function #98

Closed katsaii closed 9 months ago

katsaii commented 9 months 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__; 
}