Add method to look up Lua script by name
This commit is contained in:
parent
bf8c256771
commit
3208535c20
|
@ -117,6 +117,8 @@ public:
|
|||
void refresh (bool run_scan = false);
|
||||
PBD::Signal0<void> scripts_changed;
|
||||
|
||||
LuaScriptInfoPtr by_name (const std::string&, LuaScriptInfo::ScriptType);
|
||||
|
||||
static LuaScriptInfoPtr script_info (const std::string &script);
|
||||
static bool try_compile (const std::string&, const LuaScriptParamList&);
|
||||
static std::string get_factory_bytecode (const std::string&, const std::string& ffn = "factory", const std::string& fp = "f");
|
||||
|
|
|
@ -337,6 +337,18 @@ LuaScripting::scripts (LuaScriptInfo::ScriptType type) {
|
|||
return _empty_script_info; // make some compilers happy
|
||||
}
|
||||
|
||||
LuaScriptInfoPtr
|
||||
LuaScripting::by_name (const std::string& name, LuaScriptInfo::ScriptType type)
|
||||
{
|
||||
LuaScriptList lsl (scripts (type));
|
||||
printf ("CHECKING %d scripts\n", lsl.size());
|
||||
for (LuaScriptList::const_iterator s = lsl.begin(); s != lsl.end(); ++s) {
|
||||
if ((*s)->name == name) {
|
||||
return (*s);
|
||||
}
|
||||
}
|
||||
return LuaScriptInfoPtr();
|
||||
}
|
||||
|
||||
std::string
|
||||
LuaScriptInfo::type2str (const ScriptType t) {
|
||||
|
|
Loading…
Reference in New Issue