Allow to pass interpreter to evaluate action-script parameters
authorRobin Gareus <robin@gareus.org>
Mon, 4 Dec 2017 23:12:42 +0000 (00:12 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 5 Dec 2017 00:55:38 +0000 (01:55 +0100)
This allows to add bindings, in particular GUI dialog, to be registered
before evaluating the parameters.

libs/ardour/ardour/lua_script_params.h
libs/ardour/luascripting.cc

index 069fe3f15d97c4d4c2bf24f879b14d81f9d621fd..c326ef703fbd4594cb5467640eed8ad447b357a6 100644 (file)
@@ -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);
 
index 5d0b45aaf5506888fe3bc126f11a37c485211846..a3276432b2bb17a173fd21ba50e4e34f97cc5abc 100644 (file)
@@ -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");