diff options
author | Robin Gareus <robin@gareus.org> | 2017-02-17 18:28:40 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-02-17 18:58:11 +0100 |
commit | 149634c2cf61a4ecaef4b86b84f8531ce0ce51a0 (patch) | |
tree | 12d88d3cc9a6e6c92f7f13e12f4691991dc0cf19 /libs/ardour/luascripting.cc | |
parent | 3b8348f0099134aeded08cc797b2c7a1efb76507 (diff) |
Allow to use any Lua function factory, produce bytecode
Diffstat (limited to 'libs/ardour/luascripting.cc')
-rw-r--r-- | libs/ardour/luascripting.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/ardour/luascripting.cc b/libs/ardour/luascripting.cc index e530793ce1..8e9157afe8 100644 --- a/libs/ardour/luascripting.cc +++ b/libs/ardour/luascripting.cc @@ -450,7 +450,7 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList& } std::string -LuaScripting::get_factory_bytecode (const std::string& script) +LuaScripting::get_factory_bytecode (const std::string& script, const std::string& ffn, const std::string& fp) { LuaState l; l.Print.connect (&LuaScripting::lua_print); @@ -461,7 +461,7 @@ LuaScripting::get_factory_bytecode (const std::string& script) "" " function dump_function (f)" " assert(type(f) == 'function', 'Factory is a not a function')" - " return string.format(\"f = %q\", string.dump(f, true))" + " return string.format(\"" + fp + " = %q\", string.dump(f, true))" " end" ); @@ -469,7 +469,7 @@ LuaScripting::get_factory_bytecode (const std::string& script) luabridge::LuaRef lua_dump = luabridge::getGlobal (L, "dump_function"); l.do_command ("dump_function = nil"); // hide it l.do_command (script); // register "factory" - luabridge::LuaRef lua_factory = luabridge::getGlobal (L, "factory"); + luabridge::LuaRef lua_factory = luabridge::getGlobal (L, ffn.c_str()); if (lua_factory.isFunction()) { return (lua_dump(lua_factory)).cast<std::string> (); |