Hey Raghava,
in fact b is not the string "zset", that's why you're if check fails.
If you look into that type the return value actually is you should get
the idea how to access the value correctly.
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> eval 'local t = redis.call("type", "foo"); return type(t)' 0
"table"
127.0.0.1:6379> eval 'local t = redis.call("type", "foo"); return
cjson.encode(t)' 0
"{\"ok\":\"string\"}"
As you can see by encoding it as json, it is actually a hashmap, so you
need to acces the "ok" field.
127.0.0.1:6379> eval 'local t = redis.call("type", "foo"); return t.ok
== "string"' 0
(integer) 1
If you do your check on "b.ok" it works as expected.
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
redis-db+u...@googlegroups.com.
> To post to this group, send email to
redi...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/redis-db.
> For more options, visit
https://groups.google.com/d/optout.