Notifications
Clear all
[Closed] function pointers?
Sep 29, 2008 6:49 pm
Are we able to do Function pointers in maxscript?
here’s a simple example i can’t get to work…or maybe my syntax is wrong.
(
fn SubValue A B =
return A-B
fn AddValue A B =
return A+B
fn CheckValues CheckFunction=
{
a = 5 ; b = 6
print( CheckFunction(a)(b) )
}
CheckValues( SubValue )
CheckValues( AddValue )
)
3 Replies
Sep 29, 2008 6:49 pm
haha :rolleyes:.
Ah…there it is. Thats what i get from going back and forth from C#.
Thanks
Sep 29, 2008 6:49 pm
This is possible because in maxscript, most syntax constructs are expressions, not statements.
In C++, an if statement is a statement:
if (true) …
because it doesn’t return anything.
In Maxscript, and if statement is actually an expression:
foo = if (true) …
Meaning an expression has a left hand side.
Chris J.