Shikloshi
Shikloshi

Reputation: 3811

ioredis (nodejs): Debugging custom command with lua script

I wrote a custom lua script so that I could run it from ioredis within my node process:

REDIS_CLIENT.defineCommand('my_command', {
            lua: fs.readFileSync(path.resolve(__dirname, './lua_scripts/my_command.lua'), {
                encoding: 'utf8'
            })
        });

I want to add prints inside my my_commands.lua so when I run client.my_command(args) it will be printed to the nodejs process stdout but when I added print "hello lua" it did not (and that makes sense).

Is there a way to print stuff out of the lua custom script into my nodejs process stdout?

Upvotes: 0

Views: 2097

Answers (1)

Itamar Haber
Itamar Haber

Reputation: 50052

There's no direct way of doing that, but there are a few indirect ways that I described here. Out of these, excluding the new v3.2 integrated Lua debugger and the Zerobrane Studio plugin, the most useful & easiest approaches to tracing IMO are using PubSub or ECHO & MONITOR.

Upvotes: 2

Related Questions