Debug Your Conversation Lua Scripts

The Answer Server installation includes IDE files to allow you to debug your Conversation system Lua scripts with the ZeroBrane Studio Lua IDE on Windows. For more information about conversation Lua scripts, see Lua Processing Scripts.

To use Lua debugging, you must install ZeroBrane Studio (see https://studio.zerobrane.com).

After you install ZeroBrane Studio, you must:

  • Copy the files from the lua_ide_files directory in your Answer Server installation to the ZeroBrane Studio installation directory, merging with the files that are already there,

  • Copy the following files from the lua directory in your Answer Server installation to a debugging project directory (which can be anywhere):

    • autn_conversation.dll A DLL for debugging conversation Lua scripts.
    • taskutils_factory.lua A helper module for constructing taskUtils objects.
    • autn_conversation.cfg A copy of the answerserver.cfg to use during debugging.

You can then create a debug script to allow you to debug individual Lua functions. The Lua debug script file must have the following code at the start, where LuaScript.lua is your conversation Lua script file:

require("autn_lua_conversation").as_global() -- load lua functions into global namespace
local factory = require("taskutils_factory") -- load factory module
require("LuaScript.lua") -- load the file that contains Lua scripts to debug

The rest of the debug script can call individual functions in your LuaScript.lua, set breakpoints and check the output.

For functions that require a taskUtils object, you can use the factory.create_taskutils helper function provided in the taskutils_factory.lua helper module. This helper module also lets you specify various input and output parameters, such as tables containing session and task variables, and tables for storing the result of API calls such as setNextTask. For more information, see the documentation in taskutils_factory.lua.

NOTE: When you debug ask operations in your Lua scripts, the script sets up all the systems in your configuration file, but any required IDOL components and Fact Bank databases must be available.

To debug Eduction validators, you must supply a License Server license key file that contains a license for Answer Server. Set the EductionLicenseFile parameter to the path to your license key in the conversation system configuration section of your debugging configuration file. For example:

[MyConversation]
EductionLicenseFile=C:\IDOL\licensekey.dat