Script editor


The script editor provides a simple Lua development environment.

Example script
Example script

Lua Scripting with Redis

Redis has built-in support for executing Lua scripts. Two reasons you might use Lua scripts with Redis are for the atomicity (due to the single-threaded nature of Redis) and reduction of round-trip communication by keeping all of the logic executed on the server.

To use Lua scripts with Redis, you must provide:

  • the body of the Lua script to execute,
  • a list of all of the keys used by the execution of the script, and
  • a list of any arguments to the script

For more information, refer to the official Redis documentation.

Key editor

Two keys with hash tags
Two keys with hash tags

Use the key editor to add any keys required as input to your Lua script. Reddie will show you the corresponding KEYS array index, any detected hash tags and verify that all keys hash to the same slot.

Add a key

Hash slots and hash tags in Redis Cluster

Redis Cluster uses the concept of hash slots to divide up data storage responsibility between each peer. (see What are Slots?).

As a result, to ensure that all of the keys used by a Lua script execution are co-located on the same server running the script, Redis requires all specified keys to hash to the same slot. To manage this, Redis Cluster supports “hash tags”.

Hash tags are sub sections of a key that are surrounded by curly braces ({}) that cause Redis to only hash that portion of the key when determining the hash slot. This allows you to guarantee that all keys are present in the same hash slot by using a key naming scheme with hash tags. Refer to the Redis Cluster specification for more information.

Argument editor

Argument have been added
Argument have been added

Use the argument editor to add arguments to the Lua script function. Reddie will show you the corresponding ARGV array index.

Add an argument

Lua editor

A very simple echo script
A very simple echo script

Develop the Lua script needed with the built-in editor. Click the Run button to execute the script with the specified keys and arguments.

Run the script


The echoed keys and argument
The echoed keys and argument

If the script generates any output, it will be displayed below the script editor.

Command history

An argument has been added
An argument has been added

Whenever a script is executed it is stored inside the browser’s local storage. This allows you to easily refer back to scripts you have written in the past. Click anywhere in the command history item to load its script, keys and arguments into the editor.

Remove script history

Was this page helpful? Yes / No

Thanks for the feedback! Please click submit below.