w3resource logo

Redis Tutorial

Redis Scripting: EVAL script numkeys key [key ...] arg [arg ...]

Secondary Nav


Redis EVAL command is used to evaluate scripts using the Lua interpreter. The first argument of EVAL is a Lua 5.1 script and the script does not need to define a Lua function. It is just a Lua program that will run in the context of the Redis server. The second argument of EVAL is the number of arguments that follows the script that represents Redis key names. These arguments can be accessed by Lua using the KEYS global variable in the form of a one-based array (so KEYS[1], KEYS[2], ...).


EVAL script numkeys key [key ...] arg [arg ...] 

Available since



redis> eval "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 key1 key2 first second
1) "key1"
2) "key2"
3) "first"
4) "second"

Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program