diff --git a/automation/v4-docs/misc.txt b/automation/v4-docs/misc.txt index 9c656f0e4..5b96d3519 100644 --- a/automation/v4-docs/misc.txt +++ b/automation/v4-docs/misc.txt @@ -40,3 +40,11 @@ Returns: 2 values, all numbers. 2. End of the selection, in milliseconds. --- + +Setting the main frame's status bar text + +function aegisub.set_status_bar_text(text) + +Returns: 0 values + +--- diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index b952b2e7c..69fc03275 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -44,6 +44,7 @@ #include "audio_timing.h" #include "command/command.h" #include "compat.h" +#include "frame_main.h" #include "include/aegisub/context.h" #include "options.h" #include "project.h" @@ -270,6 +271,19 @@ namespace { return 2; } + int lua_set_status_text(lua_State *L) + { + const agi::Context *c = get_context(L); + if (!c || !c->frame) { + lua_pushnil(L); + return 1; + } + std::string text = check_string(L, 1); + lua_pop(L, 1); + c->frame->SetStatusText(text); + return 0; + } + int project_properties(lua_State *L) { const agi::Context *c = get_context(L); @@ -473,6 +487,7 @@ namespace { set_field(L, "gettext"); set_field(L, "project_properties"); set_field(L, "get_audio_selection"); + set_field(L, "set_status_text"); // store aegisub table to globals lua_settable(L, LUA_GLOBALSINDEX);