From 79ba9154115b56ca4f2aab0341f454fc09d93235 Mon Sep 17 00:00:00 2001 From: Mikulas Florek Date: Tue, 19 Nov 2024 22:54:16 +0100 Subject: [PATCH] fixed lua console - run on entity --- data/editor/scripts/plugins/lua_console.lua | 2 +- data/editor/scripts/plugins/open_script_action.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/editor/scripts/plugins/lua_console.lua b/data/editor/scripts/plugins/lua_console.lua index 9a84394f39..598a9671cd 100644 --- a/data/editor/scripts/plugins/lua_console.lua +++ b/data/editor/scripts/plugins/lua_console.lua @@ -33,7 +33,7 @@ function execute() for i = 1, selected_count do local entity = Editor.getSelectedEntity(i - 1) if entity.lua_script == nil then continue end - local env = entity.lua_script[0] + local env = entity.lua_script[1] if env ~= nil then setfenv(f, env) f() diff --git a/data/editor/scripts/plugins/open_script_action.lua b/data/editor/scripts/plugins/open_script_action.lua index e9d9e57c21..c74ada2b78 100644 --- a/data/editor/scripts/plugins/open_script_action.lua +++ b/data/editor/scripts/plugins/open_script_action.lua @@ -5,7 +5,7 @@ Editor.addAction { run = function() if Editor.getSelectedEntitiesCount() ~= 1 then return end local e = Editor.getSelectedEntity(0) - if e.lua_script[0] == nil then return end + if e.lua_script[1] == nil then return end local script_path = e.lua_script:getScriptPath(0) Editor.asset_browser:openEditor(script_path) end