In Fusion expression fields you can prefix the line with a colon
: and then write Lua. The code you enter is executed as a function, and so the value you want to return to the control should be returned with a return statement.
For example:
- Code: Select all
: x = math.random(0,100) ; return x
You can also write standalone scripts with optional user interfaces, and Fuses which are user-created tools and modifiers. Fuses and expressions support Lua only. Scripts support both Lua and Python.
Also, all Fusion nodes, and the entire Fusion composition, are created from Lua code. Copy any node in Fusion and paste it into text editor and you will see it is created entirely out of Lua code. This allows hand-editing of individual nodes or entire compositions. This is especially useful for editing advanced macros.
For some documentation, Google for the Fusion 8 Scripting Guide (yes, they've not updated it since then), and for "VFXPedia". Also the We Suck Less forum will have many examples, and is the best place to ask and discuss more advanced Fusion concepts. We Suck Less also hosts Reactor, the Fusion and Resolve package manager, which includes many great community-created scripts, macros, Fuses, compositions and more.
Standalone scripting also applies to Resolve, where scripts can be written in Lua and Python. However there's no expressions in Resolve (except in the Text+ effect, but that's actually a Fusion effect just made available direct on the Edit page)