Notifications
Clear all
[Closed] classof struct Name?
Jul 31, 2008 11:14 pm
Is there a way to get the struct name for a defined struct?
I can do classof struct and it’ll return the entire struct definition but what if I just want the name to check it against a string?
the dirty way is to do something like:
classof structvar as string == structdef as string
or even worse:
((filterstring (classof structvar as string) "(:")[2]) == "NameString"
2 Replies
Jul 31, 2008 11:14 pm
playing with strings seems the only way
Though, if you’re doing a comparison, presumably you have a structure definition to test against? If so, you can do “isKindOf bar foo”, where bar is a struct instance and foo is a struct definition. Yields true if bar is an instance of foo.
Jul 31, 2008 11:14 pm
That works perfectly
I tried:
classof structvar == structdef
and that always returned false.
isKindof is actually what I wanted.