< Previous | Contents | Next >

Console

Fusion has a console build-in that outputs print statements in scripts. This is useful for scripts without a GUI, or as tool for simple debugging.

For example:

> Lua


print(“Hello World.”)


print “Hello World.” # This only works with Python 2.x

print(“Hello World.”)

> Python



In all cases, the console will show “Hello World.” If executed from the console, the command will be mirrored in the console preceding the interpreter: Lua>, Py2> or Py3>

When used with a collection, print will only output the reference to the collection. To display its content in a preformatted way, use:

> Lua


dump(comp:GetAttrs())



image

Tip

If used in the console, FusionScript offers a short form of dump for Lua and Python:

==comp:GetAttrs() -- Same as the command above

The same can be achieved in Python with a module called “Data pretty printer” (pprint).

pprint(comp.GetAttrs())

from pprint import pprint # Needs to be loaded once

> Python



Please note that all the collections coming from FusionScript are essentially Lua tuples. Compare to the chapter Scripting Languages.