Skip to content


zrange withscores not parsed well #7

beedub opened this Issue · 3 comments

2 participants


Parsed reply bodies from zrange with "withscore" option do not have any delimiter between the member and score, thus making the reply almost impossible to interpret.

Some test code below. The /redis location is a raw_response redis interpretor that is used in many of your examples. The output is 1 999888, which is confusing.

local parser = require "redis.parser"
local req = parser.build_query( { "zadd", "test", 888, 999 } )
req = req .. parser.build_query( { "zrange", "test", 0, -1, "withscores" })

local res = ngx.location.capture("/redis?2",
                 { body = req })

local replies = parser.parse_replies(res.body, 2)

-- formatted reply
for i, reply in ipairs(replies) do
   local res, typ = reply[1], reply[2]

(Awesome work on open_resty btw!)

OpenResty member
OpenResty member

BTW, you may also want to take a look at the lua-resty-redis library: This library is more flexible and more convenient to use than ngx_redis2 + lua-redis-parser. Also lua-resty-redis can be more efficient.

OpenResty member

Any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.