X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fluascripting.cc;h=1193e081301834acd875ebe41440c1d32e93bd83;hb=79f01bc889d6c928345214eaba9016c6396bcfca;hp=e2fc9d49f109a5c2572cf7648e771c6ed3430dc0;hpb=e0a83a758e458b56d55a0e0beceb90129fc02354;p=ardour.git diff --git a/libs/ardour/luascripting.cc b/libs/ardour/luascripting.cc index e2fc9d49f1..1193e08130 100644 --- a/libs/ardour/luascripting.cc +++ b/libs/ardour/luascripting.cc @@ -294,9 +294,11 @@ LuaScripting::scan_script (const std::string &fn, const std::string &sc) luabridge::LuaRef lua_ss = luabridge::getGlobal (L, "session_setup"); if (lua_ss.isFunction ()) { - if (lua_ss () == true) { - lsi->subtype |= LuaScriptInfo::SessionSetup; - } + try { + if (lua_ss () == true) { + lsi->subtype |= LuaScriptInfo::SessionSetup; + } + } catch (...) { } } } @@ -371,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"); @@ -385,7 +393,7 @@ LuaScriptParams::script_params (const std::string& s, const std::string &pname, } else { lua.do_command (s); } - } catch (luabridge::LuaException const& e) { + } catch (...) { return rv; } @@ -402,6 +410,7 @@ LuaScriptParams::script_params (const std::string& s, const std::string &pname, std::string title = i.value ()["title"].cast (); std::string dflt; bool optional = false; + bool preseeded = false; if (i.value ()["default"].isString ()) { dflt = i.value ()["default"].cast (); @@ -409,7 +418,10 @@ LuaScriptParams::script_params (const std::string& s, const std::string &pname, if (i.value ()["optional"].isBoolean ()) { optional = i.value ()["optional"].cast (); } - LuaScriptParamPtr lsspp (new LuaScriptParam(name, title, dflt, optional)); + if (i.value ()["preseeded"].isBoolean ()) { + preseeded = i.value ()["preseeded"].cast (); + } + LuaScriptParamPtr lsspp (new LuaScriptParam(name, title, dflt, optional, preseeded)); rv.push_back (lsspp); } } @@ -482,7 +494,7 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList& cerr << e.what() << "\n"; #endif lua_print (e.what()); - } + } catch (...) { } return false; } @@ -513,7 +525,7 @@ LuaScripting::get_factory_bytecode (const std::string& script, const std::string if (lua_factory.isFunction()) { return (lua_dump(lua_factory)).cast (); } - } catch (luabridge::LuaException const& e) { } + } catch (...) { } return ""; }