Commit 6ac566fc authored by Arun Raghavan's avatar Arun Raghavan
Browse files

m-lua-scripting: Add WpImplModule bindings

parent b9b722c1
Pipeline #381296 passed with stages
in 1 minute and 4 seconds
......@@ -1297,6 +1297,35 @@ static const luaL_Reg state_methods[] = {
{ NULL, NULL }
};
/* ImplModule */
static int
impl_module_new (lua_State *L)
{
const char *name, *args = NULL;
WpProperties *properties = NULL;
name = luaL_checkstring (L, 1);
if (lua_type (L, 2) != LUA_TNONE)
args = luaL_checkstring (L, 2);
if (lua_type (L, 3) != LUA_TNONE) {
luaL_checktype (L, 3, LUA_TTABLE);
properties = wplua_table_to_properties (L, 2);
}
WpImplModule *m = wp_impl_module_load (get_wp_export_core (L),
name, args, properties);
if (m) {
wplua_pushobject (L, m);
return 1;
} else {
return 0;
}
}
void
wp_lua_scripting_api_init (lua_State *L)
{
......@@ -1352,6 +1381,8 @@ wp_lua_scripting_api_init (lua_State *L)
NULL, pipewire_object_methods);
wplua_register_type_methods (L, WP_TYPE_STATE,
state_new, state_methods);
wplua_register_type_methods (L, WP_TYPE_IMPL_MODULE,
impl_module_new, NULL);
wplua_load_uri (L, URI_API, 0, 0, &error);
if (G_UNLIKELY (error))
......
......@@ -206,4 +206,5 @@ SANDBOX_EXPORT = {
Link = WpLink_new,
Pod = WpSpaPod,
State = WpState_new,
ImplModule = WpImplModule_new,
}
Markdown is supported
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