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 D8EE920BA1 for ; Thu, 5 Sep 2019 17:28:31 -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 VAJdhUwRIGs7 for ; Thu, 5 Sep 2019 17:28:31 -0400 (EDT) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 6C3432450A for ; Thu, 5 Sep 2019 17:28:31 -0400 (EDT) Received: by mail-lj1-f182.google.com with SMTP id a22so4041922ljd.0 for ; Thu, 05 Sep 2019 14:28:31 -0700 (PDT) From: Cyrill Gorcunov Subject: [tarantool-patches] [PATCH 1/6] box/console: Add mapping for direct symbols Date: Fri, 6 Sep 2019 00:28:10 +0300 Message-Id: <20190905212815.7311-2-gorcunov@gmail.com> In-Reply-To: <20190905212815.7311-1-gorcunov@gmail.com> References: <20190905212815.7311-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: Konstantin Osipov , Alexander Turenko , 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..22bafab3a 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 + end + end -- -- Map internal symbols which serpent doesn't know -- about to a known representation. -- 2.20.1