Get script/function name from constructor?

L

lorewap3

Guest
I have a struct constructor like this:

GML:
function State() constructor {
}
that has various children like this

GML:
function StateWalk(): State() constructor {

}
If I declare a variable:
state = new StateWalk();

How do I figure out the function by the variable itself? IE, "StateWalk" from only the state variable. I have a debugging function within State() constructor where I'm trying to output the name of the function used, but I'm not going to know which of the children was used to construct it.

Is there a way to do something like script_get_name(self)? I can't test it against every function with instanceof, that would be silly. I'm not sure of which built-in method would allow me to figure this out.

Thanks!
Will
 

Nidoking

Member
I can't test it against every function with instanceof, that would be silly.
If it's that silly, maybe you have too many constructors that could call whatever debug thing you're doing. But you may be best off putting a FunctionName variable in there and just using that.
 
Top