Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroBrane Studio #1268

Closed
krasnovpro opened this issue Mar 25, 2017 · 4 comments
Closed

ZeroBrane Studio #1268

krasnovpro opened this issue Mar 25, 2017 · 4 comments

Comments

@krasnovpro
Copy link

Is there possibility to debug hammerspoon scripts in zerobrane studio?

@asmagill
Copy link
Member

Maybe... glancing at the Wireshark debugging page (http://notebook.kulchenko.com/zerobrane/debugging-wireshark-lua-scripts-with-zerobrane-studio) it looks like you'll need to update your package.path and package.cpath variables with the path to the ZeroBrane application and then add require("mobdebug").start() to your init.lua...

The Wireshark examples are all for Windows and involve setting external environment variables... but the concepts are the similar... this is untested, but I suspect the following or something similar might work:

local ZBS = "/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio"
package.path = package.path .. ";" .. ZBS .. "/lualibs/?/?.lua;" .. ZBS .. "/lualibs/?.lua"
package.cpath = package.cpath .. ";" .. ZBS .. "/bin/?.so;" .. ZBS .. "/bin/clibs53/?.so"
require("mobdebug").start()

The studio looks interesting and I may give it a whirl myself, but my time is limited at the moment, so I don't know when I'll get around to trying it out myself... hopefully this should get you moving in the right direction.

@asmagill
Copy link
Member

Minor update:

local ZBS = "/Applications/_ASM_/Developer/ZeroBraneStudio.app/Contents/ZeroBraneStudio"
package.path = package.path .. ";" .. ZBS .. "/lualibs/?/?.lua;" .. ZBS .. "/lualibs/?.lua"
package.cpath = package.cpath .. ";" .. ZBS .. "/bin/?.dylib;" .. ZBS .. "/bin/clibs53/?.dylib"
require("mobdebug").start()

@cmsj
Copy link
Member

cmsj commented Mar 27, 2017

Works for me, I added that snippet (without the "ASM/Developer/" part, since that's specific to where @asmagill keeps his applications :) to the top of my init.lua, opened init.lua in ZeroBrane and started its debugging server, told Hammerspoon to reload its config and bam, I was stepping through my init.lua and could interact with the hammerspoon Lua instance in the ZeroBrane console.

Very cool stuff :)

@cmsj cmsj closed this as completed Mar 27, 2017
@asmagill
Copy link
Member

Ooops! I usually edit that kind of thing out... sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants