lua how to debug - mtanksl/OpenTibia GitHub Wiki
How to debug .lua scripts
- Download ZeroBrane Studio IDE.
- Launch the IDE.
- Click
Menu > Edit > Preferences > Settings: User
.
- Add a line with
editor.autoactivate = true
.
- Relaunch the IDE.
- Click
Menu > Project > Start Debugger Server
.
- Click
Menu > Project > Project Directory > Start Debugger Server > Choose...
and select \mtanksl.OpenTibia.GameData\data\
.
- Open
\plugins\npcs\lib.lua
in the project window, for example.
- Insert the function
debugger.start()
inside the function npchandler:onsay(npc, player, message)
, for example.
- Add breakpoints.
- Run the server.
- Talk to some NPC.
- 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.
- Now go have some fun!