PDA

View Full Version : How to get variable type?


stuh505
10-23-2005, 03:17 PM
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

Bobo
10-23-2005, 04:29 PM
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


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.

CGTalk Moderation
10-23-2005, 04:29 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.