Skip to content

Commit

Permalink
fix lua nil for nested values
Browse files Browse the repository at this point in the history
Also for #43
  • Loading branch information
alicebob committed Jun 20, 2018
1 parent 797e41a commit 8a7a8d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions integration/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ func TestEval(t *testing.T) {
succ("EVAL", "return {ARGV[1]}", 0, "first\nwith\nnewlines!\r\r\n\t!"),
succ("EVAL", "return redis.call('GET', 'nosuch')==false", 0),
succ("EVAL", "return redis.call('GET', 'nosuch')==nil", 0),
succ("EVAL", "local a = redis.call('MGET', 'bar'); return a[1] == false", 0),
succ("EVAL", "local a = redis.call('MGET', 'bar'); return a[1] == nil", 0),

// failure cases
fail("EVAL"),
Expand Down
2 changes: 1 addition & 1 deletion lua.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func redisToLua(l *lua.LState, res []interface{}) *lua.LTable {
for _, e := range res {
var v lua.LValue
if e == nil {
v = lua.LValue(nil)
v = lua.LFalse
} else {
switch et := e.(type) {
case int64:
Expand Down

0 comments on commit 8a7a8d4

Please sign in to comment.