I have an understanding problem..
struct tTest ( fnptr = undefined, fn tst = ( fnptr() ), fn setfnptr func = ( fnptr = func ) ) fn TestFoo = ( print "TestFoo" ) foo = tTest() foo.setfnptr TestFunc foo.tst()
Why is "TestFoo" printed out twice?
btw, the foll. does the same:
xyx = TestFoo xyx()
How can I be sure, the function will only be called once?
Solved! Go to Solution.
Solved by Swordslayer. Go to Solution.
It's called once, every function in maxscript returns something, you could just as well write it as fn TestFoo = return (print "TestFoo"), and the return value for print is the string it prints. Maxscript listener shows the return values of everything that gets executed in global scope and of the last expression in local scope. If the function was for example fn TestFoo = (print "TestFoo"; OK), it would print the string and return OK.