Debugging plugins

Currently, Appetizer provides two ways to debug scripts:

1. The log window

The log window outputs error message whenever there is a problem with a plugin. You can enable this window by starting Appetizer with the --logwindow flag. This can be done for example by creating a new shortcut of Appetizer, as explained below:

- Right-click on Appetizer.exe and select "Create shortcut"

- Right-click on the new shortcut and select "Properties"

- In the "Target" field, append "--logwindow" to the executable name

Now click OK and launch the shortcut. The log window should now be visible. The messages related to plugins all start with [Lua Script] or [Lua Host]. In particular, whenever there is an error in a plugin script, you should see something like: [Lua Host] [Error] path/to/file/main.lua:123 where "123" is the line number.

2. The trace() function

The second way to debug a plugin is using the global trace() function. Its purpose is to output a message to the log window and thus you can keep track of the internal state of the plugin. Have a look at the API reference for more information: trace() function