1

I'm using Lua in the unity3d engine. I used ZeroBrane Studio to debug my Lua code, but some breakpoints are never fired. I call "Main.lua" by load buffer c API, I set breakpoints at the beginning of the Main.lua, and it is fired. Main.lua looks like this:

print("main.lua begin.")
print(package.path)
require "mytest.lua"
mytest_func()

mytest.lua looks like this:

print("mytest.lua")
print("test zerobranestudio debug")
function mytest_func()
    print("mytest_func called")
end

the breakpoints in mytest.lua cannot be fired. I checked for ZeroBrane Studio's FAQ but still can't figure out the reason why breakpoints in required Lua file can't be fired. Any advice appreciated!

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56
van will
  • 11
  • 2
  • 1
    It would be useful to go through the list of reasons why breakpoints may not be firing (https://studio.zerobrane.com/doc-faq#why-breakpoints-are-not-triggered) to check if anything applies. I would print `debug.getinfo(1,"S").source` value from the main script and `mytest.lua` as suggested in the third item on the list. – Paul Kulchenko Sep 26 '18 at 17:53
  • 1
    Thanks very much for your suggestion! print(debug.getinfo(1,"S").source) prints "?" in mytest.lua. main.lua is ok. I added the base search path and set Lua loader to search in the search paths, then return the full path for Lua calling load buffer. This solved my problem and now I can set debugpoint anywhere and it will be triggered. – van will Sep 27 '18 at 05:42
  • Maybe write it up as the answer and accept it (when you get enough reputation). – Paul Kulchenko Sep 27 '18 at 05:51
  • I'm sorry for hot having enough reputation to close this question. – van will Sep 27 '18 at 06:26

0 Answers0