Describe the bug
...
To reproduce
$ redis-cli -3 -h host
host:6379> eval 'redis.setresp(3); return { map={hello="world"} }' 0
1# "world" => "hello"
Expected behavior
I think we should return "hello" => "world".
Additional information
Relevant code starts here, returning value first seems an unusual choice. It may break uniqueness assumptions on keys anyway.
Comment From: oranagra
@XeCycle thanks for reporting. for the record, even if the real client (redis-cli) is in RESP2 mode, this is messed up, and even if Lua didn't pick RESP3:
127.0.0.1:6379> eval 'redis.setresp(3); return { map={hello="world"} }' 0
1) "world"
2) "hello"
127.0.0.1:6379> eval 'redis.setresp(2); return { map={hello="world"} }' 0
1) "world"
2) "hello"
and maybe even more obvious with HGETALL on RESP2 client
127.0.0.1:6379> hset h hello world
(integer) 1
127.0.0.1:6379> eval 'redis.setresp(3); return redis.call("hgetall", "h")' 0
1) "world"
2) "hello"
127.0.0.1:6379> eval 'redis.setresp(2); return redis.call("hgetall", "h")' 0
1) "hello"
2) "world"
i hope no one wrote any code yet that relies on the bug, it'll break as soon as we fix it.