Concepts

Before diving into the concepts of LDT, if you need more information about the concepts of Lua itself, you are highly encouraged to refer to the Lua manual ( http://www.lua.org/manual/5.1/).

Remote Debug

The Debugger of Lua Development Tools is based on the DBGP protocol, and the IDE implements a DBGP server.
To connect to this server, and begin remote/attach debugging, you need to use a DBGP Lua client.

DBGP Client

The DBGP Lua client is composed of two Lua files ( debugger.lua and debugintrospection.lua).
It runs on Unix-like OS and Windows (XP and later). It is written in Lua 5.1 and depends on lua-socket.
You can get Lua on http://www.lua.org/download.html and install lua-socket thanks to luarocks, or via your official OS repositories.

To use it, you must have these two files in your lua path.
To begin the connection, you must execute this Lua code :

> local initconnection = require("debugger")
> initconnection(host, port, idekey)

which can be shortened like this:

> require("debugger")(host, port, idekey)

So, to debug any Lua script, you can do:

lua -e "require('debugger')("idehost","ideport");" MyApp.lua

or even just go with:

lua -e "require('debugger')();" MyApp.lua

if you want to rely on default values for the debug host and port (which should be 127.0.0.1:10000 if you didn't tweak any DBGP_* environment variable).

DBGP Server

The DBGP Server is integrated in LDT.
In order to accept incoming debug sessions, you must create a new Remote Lua Application launch configuration, then launch it.

Go in Run/Debug Configurations....


Now you can start your debug session by clicking Debug. IDE will wait for an incoming connection from the debugger client, on the port you can see in the debug view.

If needed, you can change the server port, in Window > Preferences > Dynamic Languages > Debug.

Paths configuration

In order to use propoperly remote debugging, you must care about paths. In our case, there are several kind of them to consider:

Project path

Project path is the one set using the '' Build Path > Configure Build Path ...'' UI. From there you can specify dependency to other project from current workspace. As a result, will enjoy completion and navigation between your project and the ones configured in Build Path.

Runtime path

Once your program is ready, you might try Remote debugging. You must ensure beforehand that all the projects you depend on are in Lua path. The configuration of this path is not detailed here since it is highly dependent on how you are managing paths in your own environment.