Redis: passing args to a LUA script

How did it came in their brain that the arguments where not stored in the ARG[] array but in the KEYS[] one ?

So if you want to call your Redis LUA script this way:

redis-cli --raw --eval myscript.lua arg1 arg2 ...

You have to access your args this way in the LUA script:

local arg1=KEYS[1]
local arg2=KEYS[2]
...

That’s awesome till you don’t know how to STDOUT print some results :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>