From d5e1f536a750906af84c490fa01176d95cdb5d3a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 5 Dec 2017 00:12:42 +0100 Subject: [PATCH] Allow to pass interpreter to evaluate action-script parameters This allows to add bindings, in particular GUI dialog, to be registered before evaluating the parameters. --- libs/ardour/ardour/lua_script_params.h | 3 +++ libs/ardour/luascripting.cc | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/lua_script_params.h b/libs/ardour/ardour/lua_script_params.h index 069fe3f15d..c326ef703f 100644 --- a/libs/ardour/ardour/lua_script_params.h +++ b/libs/ardour/ardour/lua_script_params.h @@ -19,6 +19,8 @@ #ifndef _ardour_lua_script_params_h_ #define _ardour_lua_script_params_h_ +#include "lua/luastate.h" + #include "ardour/libardour_visibility.h" #include "ardour/luascripting.h" @@ -38,6 +40,7 @@ namespace ARDOUR { namespace LuaScriptParams { LIBARDOUR_API LuaScriptParamList script_params (const LuaScriptInfoPtr&, const std::string &); LIBARDOUR_API LuaScriptParamList script_params (const std::string &, const std::string &, bool file=true); + LIBARDOUR_API LuaScriptParamList script_params (LuaState&, const std::string &, const std::string &, bool file=true); LIBARDOUR_API void params_to_ref (luabridge::LuaRef *tbl_args, const LuaScriptParamList&); LIBARDOUR_API void ref_to_params (LuaScriptParamList&, luabridge::LuaRef *tbl_args); diff --git a/libs/ardour/luascripting.cc b/libs/ardour/luascripting.cc index 5d0b45aaf5..a3276432b2 100644 --- a/libs/ardour/luascripting.cc +++ b/libs/ardour/luascripting.cc @@ -373,10 +373,16 @@ LuaScriptParams::script_params (const LuaScriptInfoPtr& lsi, const std::string & LuaScriptParamList LuaScriptParams::script_params (const std::string& s, const std::string &pname, bool file) +{ + LuaState lua; + return LuaScriptParams::script_params (lua, s, pname, file); +} + +LuaScriptParamList +LuaScriptParams::script_params (LuaState& lua, const std::string& s, const std::string &pname, bool file) { LuaScriptParamList rv; - LuaState lua; lua_State* L = lua.getState(); lua.sandbox (true); lua.do_command ("function ardour () end");