Maxscript struct help please

Hi

I have been scripting in python for a while and now using its classes but have started a job with maxscript so looked into the structs,

I have been able to make a few basic examples to learn maxscript but every time i have had to pre define the struct name in

a global variable before structure definition itself, is this the right way of doing this?

for example

below will error
struct someData
(
var1 = 1,
var2 = 2
)
with

– Compile error: Undeclared variable: someData
– In line: struct someData

but defining global someData first will then work

Sorry for such a basic question but i havent been able to find a definitive answer in the docs
probably missed something

Thanks
d.b

You need to instantiate the struct before being able to access it.


struct someData
(
var1 = 1,
var2 = 2
)

-- instantiate the struct
some_struct = someData()
> (someData var1:1 var2:2)

-- get the var1 variable
some_struct.var1
> 1

hi and thanks for the reply

I was not even getting to the instanciating part of the script before,
I must have had a bust bracket somewhere previously because now
when i try to define the struct it works fine after restarting max

thanks
d.b