Last updated 2 years ago by Brian P O'RourkeLua
You’ve heard that Redis has an embedded scripting language, but haven’t given it a try yet? Here’s a tour of what you need to understand to use the power of Lua with your Redis server.
Our first Redis Lua script just returns a value without actually interacting with Redis in any meaningful way:
local msg = "Hello, world!"
This is as simple as it gets. The first line sets up a local variable with our message, and the second line returns that value from the Redis server to the client. Save this file locally as hello.lua and run it like so:
redis-cli --eval hello.lua