[tarantool-patches] [PATCH 3/3] box/console: Test for nil value in args directly

Cyrill Gorcunov gorcunov at gmail.com
Sat Jul 27 01:17:12 MSK 2019


Instead of allocating a variable for optional args
testing we should use dot notation instead. Otherwise
it won't work for trivial test case as

```
require('console').set_default_output('lua,block')
require('decimal').new('1234.5678')
```

 | builtin/box/console.lua:47: expected decimal, number or string as 2 argument

and program exits.

Part-of #3834
---
 src/box/lua/console.lua | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua
index 0c521b44a..64086cf5b 100644
--- a/src/box/lua/console.lua
+++ b/src/box/lua/console.lua
@@ -41,10 +41,9 @@ output_handlers["yaml"] = function(status, opts, ...)
 end
 
 output_handlers["lua"] = function(status, opts, ...)
-    local data = ...
     --
     -- Don't print nil if there is no data
-    if data == nil then
+    if not ... then
         return ""
     end
     --
-- 
2.20.1





More information about the Tarantool-patches mailing list