Maxscript Encapsulation

Maxscript Encapsulation

Anonymous
Not applicable
635 Views
1 Reply
Message 1 of 2

Maxscript Encapsulation

Anonymous
Not applicable

I've been trying to use a struct to "encapsulate" some code 

But creating an enormous struct with comma separation for clauses is difficult to read, and leaving out a comma is an easy mistake. 

so I wanted to assign a function to a variable within that struct and then perhaps define the function later (like a header). 

eg: 

c = function Addnumbers a b = a +b

 

so the classof c = MAXScriptFunction

 

and I can use

c  10 20

to get the result 30. 

but if a say 

c = undefined

I can still execute addnumbers. 

I will have to try it in a struct as private and see what happens. 

but 
i cannot understand this explanation of the const keyword.  

http://help.autodesk.com/view/3DSMAX/2016/ENU//index.html?guid=__files_GUID_B28D7100_1F5F_4A0F_BFA3_...

 

and what the apply() function is and how to use it as I can see no other reference to it. 

 

0 Likes
636 Views
1 Reply
Reply (1)
Message 2 of 2

k4noe_vi
Contributor
Contributor

[code]

global c =()
c = fn addNm a b = return a+b
c 3 5

[/code]

0 Likes