天天看點

ZeroBrane Studio遠端調試Lua程式(轉)

環境:

ZeroBrane Studio安裝在Windows 7上,而要調試的程式運作在CentOS上;

設定:

在windows 7上,打開ZeroBrane Studio,打開需要調試的檔案,例如test.lua

然後選擇Project -> Start Debugger Server,Output中可以看到Debugger server started at WIN:8172,

然後點選行号後面設定斷點。

在CentOS上,需要先安裝ZeroBrane Studio,安裝成功後設定環境變量, 我是直接修改主目錄下的.bashrc檔案:

# cd ~

# vi .bashrc 

增加如下3行:

export ZBS=/opt/zbstudio  

export LUA_PATH="./?.lua;$ZBS/lualibs/?/?.lua;$ZBS/lualibs/?.lua"  

export LUA_CPATH="$ZBS/bin/linux/x64/?.so;$ZBS/bin/linux/x64/clibs/?.so"  

然後将windows 上已經編輯好的test.lua檔案拷貝到CentOS上,并在檔案最上面增加一行

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

把1.2.3.4替換成你的windows的IP位址。

最後,在CentOS上執行Lua腳本,lua test.lua,看一下你的windows上的調試器已經啟動了吧!

如有任何疑問,歡迎留言,可以一起讨論。

http://blog.csdn.net/propro1314/article/details/49618197

繼續閱讀