Redis的Lua脚本很强大,要是能够调试就好了。我尝试了几种方式,中间绕了不少弯路,最终还是搞定了,分享一下操作步骤,希望对大家有帮助。
- 安装Redis,一定要用最新版本,之前用Windows下的3.2.1版本能调试,但不能逐行进行断点调试,最后在Ubuntu下试了下Redis5.0.0才执行调试。安装步骤可参考:https://blog.youkuaiyun.com/xiangwanpeng/article/details/54586087,他用的不是最新版本,要用最新版本!!!
- 下载Lua编辑器ZeroBrane Studio:https://studio.zerobrane.com/support,没有强制付费https://studio.zerobrane.com/download?not-this-time,我用的是免安装版。
- 下载ZeroBrane Studio的Redis扩展:https://raw.githubusercontent.com/pkulchenko/ZeroBranePackage/master/redis.lua。把它命名为redis.lua,并保存到ZeroBrane Studio执行目录下的packages文件。
- 重启ZeroBrane Studio,执行Project→Lua Interpreter→Redis
- 写两行代码来试试,按F5。哈哈,是不是很强大,反正我认为很强大了。