Pages

Thursday, February 26, 2009

Including Scripts Within Scripts

MAXScript provides a compile-time source-file include mechanism, allowing you to break up large scripts into smaller files that can be included at nearly any point in a script. You can use the include construct at any point in your code to effectively insert the contents of a file at that point in your code.

The form is: include "filename_string"

Example:

utility foo "Baz"
(
   local a, b, c
   include "foo-ui.ms"
   rollout bar "Bar"
   (
      include "bar-rollout.ms"
   )
   include "foo-handlers.ms"
)

This is a compile-time construct, therefore the file name specification must be a string literal, and not a variable or an expression.

No comments:

Post a Comment

Thanks for your comment