Notifications
Clear all

[Closed] How to get variable type?

Is there a way to check what the type of a variable is, ie “integer,” “string,” or the name of the struct that it is an instance of?

edit: I found it. you can just say

classOf obj

and if it is a struct, you’d check by saying

classOf obj == structName

1 Reply
1 Reply
(@bobo)
Joined: 1 year ago

Posts: 0

Please note that classOf returns the type of the VALUE stored in the variable, as variables in MAXScript “morph” to accomodate the class of whatever is stored in them. This is why you cannot preinitialize the type of a variable as in most other languages, just the scope.