Lua: add arguments to trigger_script_by_name

This commit is contained in:
Ben Loftis 2022-05-23 09:52:25 -05:00
parent 817fccb3e5
commit 3387d127e7
3 changed files with 6 additions and 2 deletions

View File

@ -712,7 +712,7 @@ private:
gint really_remove_region_marker (ArdourMarker*);
void goto_nth_marker (int nth);
void trigger_script (int nth);
void trigger_script_by_name (const std::string script_name);
void trigger_script_by_name (const std::string script_name, const std::string args = "");
void toggle_marker_lines ();
void set_marker_line_visibility (bool);

View File

@ -873,7 +873,7 @@ static void _lua_print (std::string s) {
}
void
Editor::trigger_script_by_name (const std::string script_name)
Editor::trigger_script_by_name (const std::string script_name, const std::string in_args)
{
string script_path;
ARDOUR::LuaScriptList scr = LuaScripting::instance ().scripts(LuaScriptInfo::EditorAction);
@ -901,6 +901,8 @@ Editor::trigger_script_by_name (const std::string script_name)
lua.do_file (script_path);
luabridge::LuaRef args (luabridge::newTable (L));
args[1] = in_args;
try {
luabridge::LuaRef fn = luabridge::getGlobal (L, "factory");
if (fn.isFunction()) {

View File

@ -400,6 +400,8 @@ public:
virtual void set_video_timeline_height (const int h) = 0;
virtual void embed_audio_from_video (std::string, samplepos_t n = 0, bool lock_position_to_video = true) = 0;
virtual void trigger_script_by_name (const std::string script_name, const std::string args = "") = 0;
virtual bool track_selection_change_without_scroll () const = 0;
virtual bool show_touched_automation () const = 0;