diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e1bcd06b7c..9c7a4a30dc 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -4000,7 +4000,7 @@ ARDOUR_UI::add_lua_script () return; } - LuaScriptParamList lsp = LuaScripting::session_script_params (spi); + LuaScriptParamList lsp = LuaScriptParams::script_params (spi, "sess_params"); std::vector reg = _session->registered_lua_functions (); ScriptParameterDialog spd (_("Set Script Parameters"), spi, reg, lsp); diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc index 0632199c08..41d81654bc 100644 --- a/gtk2_ardour/luainstance.cc +++ b/gtk2_ardour/luainstance.cc @@ -677,7 +677,7 @@ LuaInstance::interactive_add (LuaScriptInfo::ScriptType type, int id) return false; } - LuaScriptParamList lsp = LuaScripting::script_params (spi, "action_params"); + LuaScriptParamList lsp = LuaScriptParams::script_params (spi, "action_params"); ScriptParameterDialog spd (_("Set Script Parameters"), spi, reg, lsp); switch (spd.run ()) { @@ -839,18 +839,9 @@ LuaInstance::lua_action (const int id, std::string& name, std::string& script, L if (!lsi) { return false; } - args = LuaScripting::script_params (lsi, "action_params"); - for (luabridge::Iterator i (static_cast(ref["args"])); !i.isNil (); ++i) { - if (!i.key ().isString ()) { assert(0); continue; } - std::string name = i.key ().cast (); - std::string value = i.value ().cast (); - for (LuaScriptParamList::const_iterator ii = args.begin(); ii != args.end(); ++ii) { - if ((*ii)->name == name) { - (*ii)->value = value; - break; - } - } - } + args = LuaScriptParams::script_params (lsi, "action_params"); + luabridge::LuaRef rargs (ref["args"]); + LuaScriptParams::ref_to_params (args, &rargs); return true; } catch (luabridge::LuaException const& e) { cerr << "LuaException:" << e.what () << endl; @@ -1216,18 +1207,9 @@ LuaCallback::lua_slot (std::string& name, std::string& script, ActionHook& ah, A if (!lsi) { return false; } - args = LuaScripting::script_params (lsi, "action_params"); - for (luabridge::Iterator i (static_cast(ref["args"])); !i.isNil (); ++i) { - if (!i.key ().isString ()) { assert(0); continue; } - std::string name = i.key ().cast (); - std::string value = i.value ().cast (); - for (LuaScriptParamList::const_iterator ii = args.begin(); ii != args.end(); ++ii) { - if ((*ii)->name == name) { - (*ii)->value = value; - break; - } - } - } + args = LuaScriptParams::script_params (lsi, "action_params"); + luabridge::LuaRef rargs (ref["args"]); + LuaScriptParams::ref_to_params (args, &rargs); return true; } catch (luabridge::LuaException const& e) { cerr << "LuaException:" << e.what () << endl; diff --git a/gtk2_ardour/luainstance.h b/gtk2_ardour/luainstance.h index 9fb11c5d94..71c29741fa 100644 --- a/gtk2_ardour/luainstance.h +++ b/gtk2_ardour/luainstance.h @@ -8,6 +8,7 @@ #include "pbd/xml++.h" #include "ardour/luascripting.h" +#include "ardour/lua_script_params.h" #include "ardour/luabindings.h" #include "ardour/session_handle.h"