【发布时间】:2018-01-24 21:43:11
【问题描述】:
我编写了一个自定义 lua 脚本,以便我可以在我的节点进程中从 ioredis 运行它:
REDIS_CLIENT.defineCommand('my_command', {
lua: fs.readFileSync(path.resolve(__dirname, './lua_scripts/my_command.lua'), {
encoding: 'utf8'
})
});
我想在我的my_commands.lua 中添加打印,所以当我运行client.my_command(args) 时,它将被打印到nodejs 进程stdout 但是当我添加print "hello lua" 时它没有(这是有道理的)。
有没有办法将 lua 自定义脚本中的内容打印到我的 nodejs 进程标准输出中?
【问题讨论】: