Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
This directory contains some examples that show how MobDebug can be used.
1. A server can be started with (server.lua):
require("mobdebug").listen() -- same as listen("*", 8172)
2. A client to debug a particular script can be started with (start.lua):
require("mobdebug").start() -- same as start("localhost", 8172)
print("Start")
local foo = 0
for i = 1, 3 do
foo = i
print("Loop")
end
print("End")
3. A client to debug an arbitrary script can be started with (loop.lua):
require("mobdebug").loop() -- same as loop("localhost", 8172)
The server can then execute "load load.lua" command, which will load
'load.lua' script for debugging.
4. To turn the debugging on and off, two methods are provided:
require("mobdebug").on() -- turns debugging on
require("mobdebug").off() -- turns debugging off
In the following script, only the lines between on() and off() calls can be
debugged. This is mostly used to improve performance of the application
being debugged as the application will run with its normal speed when
the debugging is turned off.
require("mobdebug").start() -- same as start("localhost", 8172)
require("mobdebug").off()
print("Start")
local foo = 0
for i = 1, 3 do
require("mobdebug").on()
foo = i
print("Loop")
require("mobdebug").off()
end
print("End")
5. To turn on debugging of coroutines, two options are available: (1) to add
require("mobdebug").on() call to each coroutine that needs to be debugged,
and (2) to add require("mobdebug").coro() call at the beginning of the
program, which will install a new coroutine.create() handler that will
enable debugging for all coroutines created using coroutine.create() call.
6. A combination of autotest.lua and auto/test.lua provides a simple way to
run tests remotely. For example, you can start the server with:
> lua autotest.lua
and then start a client with:
> lua loop.lua
The server will detect that the client connected and will load auto/test.lua
and execute it remotely. It will run a set of commands and test values
against expected results. This allows for testing some functionality
on a remote platform (for example, a mobile device or a simulator) that
a host platform doesn't have. The output syntax follows Test Anything
Protocol (TAP) and can be integrated with existing test harnesses.