1)powershell
PS C:\Users\LX-SLM\Desktop> redis-cli -h 127.0.0.1 -p 36379 -a xxx --eval r.lua

2)lua
local res={}
local cursor='0'
repeat
local scanRet=redis.call('SCAN',cursor,'MATCH','Player_*','COUNT',1000,'TYPE','hash')
cursor=scanRet[1]
local keys=scanRet[2]
for _,k in ipairs(keys)do
local v=redis.call('HGET',k,'friendSize')
local num=tonumber(v or 0)
if num>0 then
-- 同时存入key和对应数值
table.insert(res,{k,num})
end
end
until cursor=='0'
return res