Working with Lua

Applies to 2023.0 Update and later

How to create and run as well as manage Lua scripts

Jump to:

To run a Lua script

  1. Open the Lua Script Library through Prepare > Run Lua Script. Use the appearing dialog to load, save, and execute Lua scripts as well as to create new ones.
  2. Select the script to be run.
  3. Click Execute Script.
Top

To run a Lua script when launching Netfabb

A command-line option runs a Lua script in Netfabb when you launch it.

  1. Navigate to the installation folder of Netfabb, typically C:\Program Files\Autodesk\Netfabb Ultimate 2023\.
  2. Find the netfabb.exe executable and create a shortcut to it.
  3. Edit the shortcut and add "/startluascript=path\to\luascript.lua" to what is already specified in the Target: field, adjusted for your Lua script file's respective path and name.
  4. Click Apply.

With a shortcut provisioned like this, you can have Netfabb load a Lua script right at launch.

Note: You cannot provide start parameters for the script itself similar to how you would call the Lua interpreter with the script name and start parameters for that script. Instead, you will have to use different means to communicate the startup parameters, such as by writing a file, for example. For a working example for this visit this response in the Netfabb forum.

Using the included executable netfabb_console.exe, Netfabb starts with as little in the ways of application windows as possible, and also terminates when the script is finished:

netfabb_console.exe -l <your Lua script>

Note: This is still not a fully headless mode and still requires graphics hardware and display to run.
Top

To add a Lua script to the library

The library has two options to make a new script available for execution in Netfabb:

Top

Editing a Lua script

To begin editing a script, choose Prepare > Run Lua Script, select the script to be edited, and click Edit Script.

Ctrl+Z is available for undoing changes.

Use Check Syntax to have Netfabb test for mistakes like missing quotation marks or closing brackets.

To save any changes, click Apply Changes, otherwise click Cancel to discard them. Both buttons close the dialog and return to the library.

Top

Using the debugger

To begin debugging a script, choose Prepare > Run Lua Script, right-click the script to be debugged, and choose Run Debugger from the context menu.

Flow controls

Debugging read-outs

Top