I\'m searching for the best way to debug Lua remotely, ( like from a web browser ).
I saw RemDebug, but the last project update was done on 2006. It works with Lua 5.0 a
I'm not sure if this is right. Hope it helps though:
Source: http://www.keplerproject.org/remdebug/example.html
This is an example of a debugging session of the following script (test.lua):
1 require"remdebug.engine"
2
3 remdebug.engine.start()
4
5 local tab = {
6 foo = 1,
7 bar = 2
8 }
9
10 print("Start")
11
12 function bar()
13 print("In bar 1")
14 print("In bar 2")
15 end
16
17 for i = 1, 10 do
18 print("Loop")
19 bar()
20 tab.foo = tab.foo * 2
21 end
22
23 print("End")
First run the RemDebug controller:
% lua50 controller.lua Lua Remote Debugger Run the program you wish to debug At this moment you can run your target program (in another window):
% lua50 test.lua Now go back to the window where you ran controller.lua (this assumes you are running test.lua inside C:\development\kepler on a Windows system):
Paused at file C:/development/kepler/test.lua Type 'help' for commands
basedir C:/development/kepler/ New base directory is C:/development/kepler/ basedir C:/development/kepler/ step Paused at file C:/development/kepler/test.lua line 6 over Paused at file C:/development/kepler/test.lua line 7 over Paused at file C:/development/kepler/test.lua line 10 over Paused at file C:/development/kepler/test.lua line 15 setb test.lua 19 run You can change to the application window anytime to see its output. Back to the debugger session:
Paused at file C:/development/kepler/test.lua line 19
run Paused at file C:/development/kepler/test.lua line 19 eval tab.foo 2 eval tab.bar 2 exec old_tab = tab nil exec tab = 2 nil eval tab 2 exec tab = old_tab nil eval tab.foo 2 run Paused at file C:/development/kepler/test.lua line 19 eval tab.foo 4 delb test.lua 19 setw tab.foo == 32 Inserted watch exp no. 1 run Paused at file C:/development/kepler/test.lua line 17 (watch expression 1: [tab.foo = 32]) eval tab.foo 32 delw 1 run Program finished