Skip to content

Instantly share code, notes, and snippets.

@nommiin
Created February 4, 2024 03:20
Show Gist options
  • Select an option

  • Save nommiin/15ce8d63948800c52b4b51f7313fb86a to your computer and use it in GitHub Desktop.

Select an option

Save nommiin/15ce8d63948800c52b4b51f7313fb86a to your computer and use it in GitHub Desktop.
Get calling GML function as normalized-string
#macro _GMFUNCTION_NAME_ array_first(string_split_ext(_GMFUNCTION_, ["gml_Script_", "gml_Object_", "gml_GlobalScript_", "@"], true, 2))
/*
function test() {
show_message(_GMFUNCTION_NAME_); // test
function does_this() {
show_message(_GMFUNCTION_NAME_); // does_this
var a = function even_work() {
show_message(_GMFUNCTION_NAME_); // even_work
var b = function() {
show_message(_GMFUNCTION_NAME_); // anon
}
b();
}
a();
}
does_this();
}
test();
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment