Skip to content

lua how to debug

mtanksl edited this page Sep 17, 2023 · 3 revisions

How to debug .lua scripts

  1. Download ZeroBrane Studio IDE.
  2. Launch the IDE.
  3. Click Menu > Edit > Preferences > Settings: User.
  4. Add a line with editor.autoactivate = true.
  5. Relaunch the IDE.
  6. Click Menu > Project > Start Debugger Server.
  7. Click Menu > Project > Project Directory > Start Debugger Server > Choose... and select \mtanksl.OpenTibia.GameData\data\.
  8. Open \plugins\npcs\lib.lua in the project window, for example.
  9. Insert the function debugger.start() inside the function npchandler:onsay(npc, player, message), for example.
  10. Add breakpoints.
  11. Run the server.
  12. Talk to some NPC.
  13. The breakpoint will be hit, press F10 to step into, Shift + F10 to step over, Ctrl + F10 to step out and F5 to continue debugging.
  14. Now go have some fun!