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.
This commit is contained in:
Robin Gareus 2017-12-05 00:12:42 +01:00
parent 2c4a8d2d25
commit d5e1f536a7
2 changed files with 10 additions and 1 deletions

View 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);

View 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");