Skip to content

Commit

Permalink
improved lua console
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Sep 11, 2023
1 parent 92c9982 commit 9fc327c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/editor/scripts/plugins/lua_console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ plugin.gui = function()
if ImGui.IsKeyPressed(ImGui.Key_DownArrow, true) then autocomplete_selected_idx += 1 end
if autocomplete_selected_idx < -1 then autocomplete_selected_idx = 0 end
if autocomplete_selected_idx >= #suggestions then autocomplete_selected_idx = #suggestions - 1 end
if ImGui.IsKeyPressed(ImGui.Key_Escape, false) then ImGui.CloseCurrentPopup() end
if ImGui.IsKeyPressed(ImGui.Key_Enter, false) then
ImGui.CloseCurrentPopup()
local k = suggestions[autocomplete_selected_idx + 1]
Expand Down
1 change: 1 addition & 0 deletions data/editor/scripts/plugins/lua_type_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ declare ImGui: {
Key_DownArrow : number,
Key_Enter : number,
Key_Escape : number,
Key_UpArrow : number
}
Expand Down
1 change: 1 addition & 0 deletions data/scripts/lumix.d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ declare ImGui: {

Key_DownArrow : number,
Key_Enter : number,
Key_Escape : number,
Key_UpArrow : number
}

Expand Down
1 change: 1 addition & 0 deletions src/engine/lua_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ void registerEngineAPI(lua_State* L, Engine* engine)
LuaWrapper::createSystemVariable(L, "ImGui", "StyleVar_WindowPadding", ImGuiStyleVar_WindowPadding);
LuaWrapper::createSystemVariable(L, "ImGui", "Key_DownArrow", ImGuiKey_DownArrow);
LuaWrapper::createSystemVariable(L, "ImGui", "Key_Enter", ImGuiKey_Enter);
LuaWrapper::createSystemVariable(L, "ImGui", "Key_Escape", ImGuiKey_Escape);
LuaWrapper::createSystemVariable(L, "ImGui", "Key_UpArrow", ImGuiKey_UpArrow);
LuaImGui::registerCFunction(L, "AlignTextToFramePadding", &LuaWrapper::wrap<ImGui::AlignTextToFramePadding>);
LuaImGui::registerCFunction(L, "Begin", &LuaImGui::Begin);
Expand Down

0 comments on commit 9fc327c

Please sign in to comment.