Skip to content

Commit 8a7a8d4

Browse files
committed
fix lua nil for nested values
Also for #43
1 parent 797e41a commit 8a7a8d4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

integration/script_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ func TestEval(t *testing.T) {
1818
succ("EVAL", "return {ARGV[1]}", 0, "first\nwith\nnewlines!\r\r\n\t!"),
1919
succ("EVAL", "return redis.call('GET', 'nosuch')==false", 0),
2020
succ("EVAL", "return redis.call('GET', 'nosuch')==nil", 0),
21+
succ("EVAL", "local a = redis.call('MGET', 'bar'); return a[1] == false", 0),
22+
succ("EVAL", "local a = redis.call('MGET', 'bar'); return a[1] == nil", 0),
2123

2224
// failure cases
2325
fail("EVAL"),

lua.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func redisToLua(l *lua.LState, res []interface{}) *lua.LTable {
163163
for _, e := range res {
164164
var v lua.LValue
165165
if e == nil {
166-
v = lua.LValue(nil)
166+
v = lua.LFalse
167167
} else {
168168
switch et := e.(type) {
169169
case int64:

0 commit comments

Comments
 (0)