[Tarantool-patches] [PATCH] Add console.print() alias for box.session.push()

Cyrill Gorcunov gorcunov at gmail.com
Thu Dec 5 19:16:21 MSK 2019


On Thu, Dec 05, 2019 at 06:53:06PM +0300, Sergey Voinov wrote:
> Currently, lack of a function like console.print() often confuses users.
> This change adds such alias.
> 
> Closes: #4393
> ---
>  issue: https://github.com/tarantool/tarantool/issues/4393
>  branch: https://github.com/tarantool/tarantool/compare/servoin/gh-4393-console_print
>  src/box/lua/console.lua       | 11 +++++++++++
>  test/app-tap/console.test.lua | 25 ++++++++++++++++++++++++-
>  2 files changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua
> index d4d8ec984..05f8016c4 100644
> --- a/src/box/lua/console.lua
> +++ b/src/box/lua/console.lua
> @@ -821,6 +821,16 @@ local function listen(uri)
>      return s
>  end
>  
> +--
> +-- Alias for box.session.push
> +--
> +local function print(message, sync)
> +    if message == nil then
> +        error('Usage: console.print(message, sync)')
> +    end
> +    return box.session.push(message, sync or box.session.sync())
> +end

Could you plase rename it to console_print() or similar since
bare print() is already overloaded too much.


More information about the Tarantool-patches mailing list