From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A10D92887F for ; Fri, 30 Aug 2019 17:48:27 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JS3ibLYe9Bog for ; Fri, 30 Aug 2019 17:48:27 -0400 (EDT) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 598942887B for ; Fri, 30 Aug 2019 17:48:27 -0400 (EDT) Received: by mail-lf1-f52.google.com with SMTP id l11so6407413lfk.6 for ; Fri, 30 Aug 2019 14:48:27 -0700 (PDT) From: Cyrill Gorcunov Subject: [tarantool-patches] [PATCH 1/5] box/console: Add mapping for direct symbols Date: Sat, 31 Aug 2019 00:48:04 +0300 Message-Id: <20190830214808.17422-2-gorcunov@gmail.com> In-Reply-To: <20190830214808.17422-1-gorcunov@gmail.com> References: <20190830214808.17422-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tml Cc: Alexander Turenko , Konstantin Osipov , Kirill Yukhin , Cyrill Gorcunov Sole symbols (such as box.NULL) are not processed by serpent "custom" symbols feature, since they are not in table. Thus we should process them separately. Without it we have > require('console').set_default_output("lua,block") > ; > box.NULL > "cdata: NULL"; instead of > box.NULL > box.NULL; as it should be. Part-of #3834 --- src/box/lua/console.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua index 64086cf5b..6cbb6b405 100644 --- a/src/box/lua/console.lua +++ b/src/box/lua/console.lua @@ -46,6 +46,17 @@ output_handlers["lua"] = function(status, opts, ...) if not ... then return "" end + -- Map internal symbols in case if they are + -- not inside tables and serpent won't handle + -- them properly. + local map_direct_symbols = { + [box.NULL] = 'box.NULL', + } + for k,v in pairs(map_direct_symbols) do + if k == ... then + return v .. output_eos["lua"] + end + end -- -- Map internal symbols which serpent doesn't know -- about to a known representation. -- 2.20.1