node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

[v5][LUA] no updates for the new scripts interface, the example does not work

Open xr0master opened this issue 7 months ago • 2 comments

Description

Hi.

After upgrading to version 5, LUA scripts don't work. The transformArguments doesn't exist anymore, and the parseCommand is required. The example at https://github.com/redis/node-redis/blob/master/examples/lua-multi-incr.js also doesn't work due to being outdated. Can someone explain the migration guide?

xr0master avatar Jun 06 '25 14:06 xr0master

Okay, I found it in the sources.

the old syntax

transformArguments(key: string, decrement: number) {
  return [key, decrement.toString()];
},

a new one

parseCommand(parser, key: string, decrement: number) {
  parser.pushKey(key);
  parser.push(decrement.toString());
},

xr0master avatar Jun 06 '25 14:06 xr0master

@xr0master thanks for flagging this, we will update the docs/examples ( or maybe you would like to contribute? )

nkaradzhov avatar Jun 09 '25 06:06 nkaradzhov