I use ZBS for developing openLuup - it's an excellent IDE, and one of my frustrations has been that I couldn't easily use its extensive breakpoints, watch window, and stack window capabilities to debug plugins.
The reason it doesn't (didn't) work is that the Lua implementation files and code, referenced in the I_xxx.xml device file, are not imported into openLuup with the usual 'require' mechanism, but are loaded as text files and 'compiled' into the device environment in a complicated mix of code coming from <functions> <files>and <action> tags in various places, so ZBS doesn't know they're being used.
However, it turns out there's a simple way around this. Here's a new plugin I'm developing/ testing... (good, eh?)
module ("L_TestPlugin", package.seeall)
function init (lul_device)
luup.log ("TEST device number is: " .. lul_device)
end
The following is the I_TestPlugin.xml implementation file:
<?xml version="1.0"?>
<implementation>
<functions>
function startup (lul_device)
local m = require "L_TestPlugin"
return m.init (lul_device)
end
</functions>
<startup>startup</startup>
</implementation>
...so the implementation file simply uses 'require' and calls the entry point (with the device number) directly.
You can set breakpoints, debug as usual, and get the right line numbers in any error messages that openLuup generates.
My thanks to both @explorer and @vosmont for sowing the seeds of this idea a long time ago.
_______________________
see @vosmont's:
openLuup: Unit/fonctional testing on openLuupfor @explorer's contributions, they are PMs to me during April 2016...
...and a key post on this thread!