lua zscore returns boolean or string?

49 views
Skip to first unread message

jason.桂林

unread,
Mar 29, 2012, 12:46:14 AM3/29/12
to redi...@googlegroups.com
local score = redis.call('zscore', 'foo', 'bar')
redis.log(3, type(score))

the score is string?

and the KEYS I pass into lua with a number, but I got a string too.

eval 'redis.log(3, type(KEYS[1]))' 1 10

--
Best regards,

Jason Green
桂林


Salvatore Sanfilippo

unread,
Mar 29, 2012, 3:38:55 AM3/29/12
to redi...@googlegroups.com
Hello, this is the expected behavior because Redis returns floats as
"bulk replies" for lack of direct "double" type in the protocol.
Explicit conversion is needed.

Salvatore

> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.

--
Salvatore 'antirez' Sanfilippo
open source developer - VMware

http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele

jason.桂林

unread,
Mar 29, 2012, 11:00:37 PM3/29/12
to redi...@googlegroups.com
I got it, Thanks

2012/3/29 Salvatore Sanfilippo <ant...@gmail.com>
Reply all
Reply to author
Forward
0 new messages