Commit 15a74052 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

lua/api: add Link() constructor

parent bf72973d
......@@ -945,6 +945,24 @@ impl_node_new (lua_State *L)
return 1;
}
/* Link */
static int
link_new (lua_State *L)
{
const char *factory = luaL_checkstring (L, 1);
WpProperties *properties = NULL;
if (lua_type (L, 2) != LUA_TNONE) {
luaL_checktype (L, 2, LUA_TTABLE);
properties = wplua_table_to_properties (L, 2);
}
WpLink *l = wp_link_new_from_factory (get_wp_core (L), factory, properties);
wplua_pushobject (L, l);
return 1;
}
/* Client */
static gboolean
......@@ -1193,6 +1211,8 @@ wp_lua_scripting_api_init (lua_State *L)
node_new, node_methods);
wplua_register_type_methods (L, WP_TYPE_IMPL_NODE,
impl_node_new, NULL);
wplua_register_type_methods (L, WP_TYPE_LINK,
link_new, NULL);
wplua_register_type_methods (L, WP_TYPE_CLIENT,
NULL, client_methods);
wplua_register_type_methods (L, WP_TYPE_SESSION_ITEM,
......
......@@ -120,6 +120,7 @@ SANDBOX_EXPORT = {
SpaDevice = WpSpaDevice_new,
Node = WpNode_new,
LocalNode = WpImplNode_new,
Link = WpLink_new,
ImplSession = WpImplSession_new,
Pod = WpSpaPod,
}
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