Brief introduction on Lua
Okay, by now we all know that LUA is an interpreted language and it has support in Redis. To make use of the capability of Redis, let's learn couple of things about LUA. Types and values supported in LUA are as follows:
Nil: Nil is a type with single value nil. On comparing it with Java, it can be taken as null.
Booleans: These will have either true or false as values.
Numbers: These represent double precession floating point numbers. So we can write our numbers as 1, 1.1, 2e+10, and so on.
String: These represent a sequence of characters as is common in most of the scripting and programming languages. In LUA, strings are immutable in nature; for example,
"Learning Redis"
and'Learning Redis'
. LUA provides methods in string library to find substring, replace characters, and so on.Tables: These are like arrays which can be indexed with numbers and strings except nil.
Control statements and loops in LUA are as follows:
The
if then else
statement: As in Java, where...