Calling Built-In Functions
All of the MAX operations that you can access with MAXScript are made available to you as functions. You invoke them with standard function calls, there is no special syntax or mechanisms especially for the MAX built-in functions. MAX functions make up the bulk of the built-in functions in MAXScript.
Special notes about function calls:
-
Functions in MAXScript are just another kind of value that can be stored in variables and arrays and passed on to other functions as arguments. Such functions are sometimes called higher-order functions. All built-in functions are values stored in reserved system global variables of the same name as the function. When you define a scripted function, the function value is placed in a global variable with the same name as the function. You can use the value in these variables and work with them as you would with other values, such as storing them in an array or passing them as arguments.
ยท
Functions that take no arguments need to called in a special way. For example, if you wanted to call a function get_current_target that takes no arguments, you could not simply write:
t = get_current_target
because this is a variable access that simply yields the function itself, and does not call the function. Instead, you must use the '()' nullary call operator:
t = get_current_target ()
-
The function to be called is defined as an <operand> in the syntax for function calls. This means that it can be an expression that is itself evaluated to get the function to call. For example:
(if a > b then sin else cos) x
-- conditional function choice
handlers[x] $box01 [1,1,1]
-- get the function out of an array