Lua to Redis conversion table.
- Lua number, Redis integer reply (the number is converted to an integer)
- Lua string--Redis bulk reply
- Lua table (array), Redis Multi Bulk reply (truncated to the first nil inside the LUA array if any)
- Lua table with a single
ok
field, Redis status reply
- Lua table with a single
err
field, Redis error reply
- Lua Boolean false, Redis Nil bulk reply.
It is also possible to summarize Redis's number,string, an array of table, Table.ok,table.err, from the type of Redis return.
Which means you want to.
return {name= "foo", passwd= "bar"} This is not possible.
That's why Redis has to put the Cjson,cmsgpack library in Lua, and you can only do that with complex types.
- Lua table with a single
ok
field, Redis status reply
- Lua table with a single
err
field, Redis error reply
For these two cases, I consider that it is not intended to use {ok= "OK"} {err= "Err"} in this form,
I'm more inclined to useredis.error_reply(error_string)和redis.status_reply(status_string)
.
Because this is more abstract, there will be fewer changes.
Redis understanding of outgoing types of LUA scripts