HMGET with an array in lua-resty-redis
我要替换此命令:
1 | red:hmget('item', 'item:1', 'item:2') |
类似:
1 2 | local test = {'item:1', 'item:2'} red:hmget('item', test) |
但是,尝试此操作时出现错误
根据您使用的Lua版本,您将要使用
-
Lua 5.1
red:hmget('item', unpack(test)) -
Lua 5.2
red:hmget('item', table.unpack(test))
1 2 | > =unpack{'item:1', 'item:2'} item:1 item:2 |