How to create and run as well as manage Lua scripts
Jump to:
- To run a Lua script
- To run a Lua script when launching Netfabb
- To add a Lua script to the library
- Editing a Lua script
- Using the debugger
To run a Lua script
- Open the Lua script library through . Use the appearing dialog to load, save, and execute Lua scripts as well as to create new ones.
- Select the script to be run.
- 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.
- Navigate to the installation folder of Netfabb, typically C:\Program Files\Autodesk\Netfabb Ultimate 2024\.
- Find the netfabb.exe executable and create a shortcut to it.
- 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.
- Click Apply.

With a shortcut provisioned like this, you can have Netfabb load a Lua script right at launch.
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>
To add a Lua script to the library
The library has two options to make a new script available for execution in Netfabb:
- Duplicate an existing script: Right-click an existing script and choose Duplicate. The duplicate is added to the library with the _Duplicated suffix.
- Create a new script: Add the bottom of the library window, click New script. In the new dialog, you may provide a name and a description. You can now type or paste your Lua code into the code window, or use the Import script function to load code from a file.
Editing a Lua script
To begin editing a script, choose Edit script.
, select the script to be edited, and clickCtrl+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.
TopUsing the debugger
To begin debugging a script, choose Run debugger from the context menu.
, right-click the script to be debugged, and chooseFlow controls
- Next steps through each line of code. It does not jump into functions, however, but executes them whole.
- Step into follows a line's jump into functions so that you can step through the function's individual lines.
- Step out executes the rest of the function immediately and returns to the line after the one that called the function.
Note: Any remaining functions called on the same level and in the same line are executed immediately as well. If you require a deeper insight into executing multiple functions, even nested functions, consider using breakpoints instead or in addition to stepping into and out of functions.
- Continue executes the rest of the entire script and closes the debugger.
Debugging read-outs
- Global variables: Variables that are always defined and available
- Local variables: Variables which are valid and available in the current scope only
- Breakpoints: Position the cursor on a line, verify that the correct line is displayed, such as lua:18, then click Add to place a breakpoint. Select a breakpoint in the list and click Remove to discard it.
- Log: Any logging calls (using system:log()) are reproduced here regardless of the current logging channel.
- Stack: Displays the current stack counter