Commit fc5aa7db authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

lua: rename Plugin() to Plugin.find()

Plugin() is confusing because it's not a constructor, it just finds
an existing instance of a plugin object. All other camel-case
functions are constructors in the current lua API.
parent e4d8f2a2
......@@ -278,6 +278,11 @@ plugin_find (lua_State *L)
return 1;
}
static const luaL_Reg plugin_funcs[] = {
{ "find", plugin_find },
{ NULL, NULL }
};
/* WpObject */
static void
......@@ -1253,8 +1258,8 @@ wp_lua_scripting_api_init (lua_State *L)
luaL_newlib (L, core_funcs);
lua_setglobal (L, "WpCore");
lua_pushcfunction (L, plugin_find);
lua_setglobal (L, "WpPlugin_find");
luaL_newlib (L, plugin_funcs);
lua_setglobal (L, "WpPlugin");
wp_lua_scripting_pod_init (L);
......
......@@ -144,7 +144,7 @@ SANDBOX_EXPORT = {
GLib = GLib,
Log = WpLog,
Core = WpCore,
Plugin = WpPlugin_find,
Plugin = WpPlugin,
ObjectManager = WpObjectManager_new,
Interest = WpObjectInterest_new,
SessionItem = WpSessionItem_new,
......
......@@ -99,7 +99,7 @@ clients_om = ObjectManager {
}
-- Set permissions to portal clients from the permission store if loaded
pps_plugin = Plugin("portal-permissionstore")
pps_plugin = Plugin.find("portal-permissionstore")
if pps_plugin then
local nodes_om = ObjectManager { Interest { type = "node" } }
nodes_om:activate()
......
......@@ -318,7 +318,7 @@ end
-- enable device reservation if requested
if config.properties["alsa.reserve"] then
rd_plugin = Plugin("reserve-device")
rd_plugin = Plugin.find("reserve-device")
end
-- if the reserve-device plugin is enabled, at the point of script execution
......
......@@ -194,7 +194,7 @@ silinks_om:connect("objects-changed", maybeRescan)
silinks_om:activate()
-- enable ducking if mixer-api is loaded
mixer_api = Plugin("mixer-api")
mixer_api = Plugin.find("mixer-api")
if mixer_api then
endpoints_om = ObjectManager {
Interest { type = "endpoint" },
......
......@@ -166,7 +166,7 @@ function reevaluateLinks ()
end
end
default_nodes = Plugin("default-nodes-api")
default_nodes = Plugin.find("default-nodes-api")
siendpoints_om = ObjectManager { Interest { type = "SiEndpoint" }}
siportinfos_om = ObjectManager { Interest { type = "SiPortInfo",
-- only handle si-audio-adapter and si-node
......
......@@ -230,7 +230,7 @@ function reevaluateLinks ()
end
end
default_nodes = Plugin("default-nodes-api")
default_nodes = Plugin.find("default-nodes-api")
metadatas_om = ObjectManager { Interest { type = "metadata" } }
siendpoints_om = ObjectManager { Interest { type = "SiEndpoint" }}
siportinfos_om = ObjectManager { Interest { type = "SiPortInfo",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment