Lua: make evaluate_lua and run_console public
This commit is contained in:
parent
c96a629c24
commit
86730990f6
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue