From 86730990f69f61d33c8fdcc83d86cec4b725c0ac Mon Sep 17 00:00:00 2001 From: David Perry Date: Wed, 4 Jan 2023 07:42:07 +0000 Subject: [PATCH] Lua: make evaluate_lua and run_console public --- epan/wslua/console.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/epan/wslua/console.lua b/epan/wslua/console.lua index d2635ef5fb..c0f404ef9b 100644 --- a/epan/wslua/console.lua +++ b/epan/wslua/console.lua @@ -10,18 +10,20 @@ -- SPDX-License-Identifier: GPL-2.0-or-later -if (gui_enabled()) then - -- Note that everything is "local" to this "if then" - -- this way we don't add globals +if (gui_enabled()) then + -- Note that evaluate_lua and run_console are NOT "local" + -- to allow them to be used in scripts (#12250) + -- Everything else is "local" to this "if then" + -- this way we don't add extra globals -- Evaluate Window - local function evaluate_lua() + function evaluate_lua() local w = TextWindow.new("Evaluate Lua") w:set_editable() -- button callback local function eval() - -- get the window's text and remove the result + -- get the window's text and remove the result local text = string.gsub(w:get_text(),"%c*--%[%[.*--%]%]$","") -- if the text begins with '=' then convert = into return @@ -50,7 +52,7 @@ if (gui_enabled()) then end -- Console Window - local function run_console() + function run_console() if console_open then return end console_open = true