lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi Dave,

Well, you can inject a debugger into the script itself. For a while I had a setup like this:

function break()
  -- 1. Open a TCP socket port 1125
  -- 2. When a client connected, load a debugger script
  -- 3. RPEL
  while true do 
   -- read line from socket
   -- eval line
   -- print output

When you inject a call to break() into your script the interpreter will block and wait for
a client to connect with `telnet localhost 1125`. I don't have the code at hand to share,
but it was not much effort to build.

Best regards,

On 31 January 2018 at 22:00, Paige DePol <> wrote: wrote:

> Here is the problem. We haven;t been able to find a way to debug ( break
> points, step thru, etc). As the program is being run to see if our lua
> script is having any bugs and if so where the bug is. So what happens is
> that if there is an issue it crashes and we have to trace our steps back
> and try to find the bug. Very painful and time consuming.
> If we had access to the c++ engine, we could have just loaded it to say
> Visual studio, add our lua files and debug while its running. But we don't
> So I am on a mission to find a way for us to debug. Any ideas you might
> have are greatly appreciated.

I am not sure you will find a way to debug your Lua scripts directly with
the engine unless the engine itself provides some sort of debugging hooks.

Which engine are you using? Have you tried to contact them to inquire about
debugging capabilities for Lua scripts? There are a number of programs out
there for Lua to allow you to edit and run scripts, however, unless they
know how to interface with your game engine they won't be of much help.

Usually game engines that come as "black boxes", where you only have the
game engine to run itself without sources, have some sort of facility to
enter a debugging mode... or come with a special debugging version of
the engine you can run while developing. Another issue is that standalone
Lua editors will not have access to the libraries present in the game
engine, making debugging scripts externally pretty much impossible.

I would suggest trying to contact the vendor of the game engine as they
will be more in a position to help you with your debugging issues.

Good luck with your game!


Dr. Heinrich Hartmann
Am Bökel 3
32351 Stemwede Levern

Mobile: +49 1525 363 8134
Landline+49 5745 9200511