0

I followed the steps in the website. snippet of my nginx conf

http {
 underscores_in_headers on;
 lua_package_path '/opt/luapoc/lua/?.lua;/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?/?.lua;/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/?.lua;;';
 lua_package_cpath '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/?.dylib;;';
 init_by_lua_block{
   num = require("numbers")
   data = num.getrandom()
   if data then
   ngx.log(ngx.DEBUG, "data is" .. data)
   end
 }

numbers.lua

require('mobdebug').start("192.168.1.155")

local M={}
function M.getrandom()
print("random function called") -- I put a break point here. 
return math.random()
end
return M

I took my IP address my ifconfg inetaddress.

I went to ZBS and set the project directory from numbers file. Then started the debug by Project -> Start debugger server.

Eventhough I gave the IP address in the require('mobdebug').start("192.168.1.155") it is staring the debug server on local host.

I am starting the nginx and expecting the flow stop at the break point I put at numbers.lua but its not.

Any idea was what's causing the ZBS to not receive debug signal?

GAK
  • 1,018
  • 1
  • 14
  • 33

1 Answers1

0

Make sure to start the debugger server in the IDE by going to Project | Start Debugger Server. It's disabled by default as it throws a firewall warning when started on some systems. You can also enable it by default by using AutoStartDebug plugin.

If this still doesn't help, try running the same script outside of nginx, from the command line to see if it works there.

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56