lua/api: add Link() constructor
This commit is contained in:
@@ -945,6 +945,24 @@ impl_node_new (lua_State *L)
|
|||||||
return 1;
|
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 */
|
/* Client */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -1193,6 +1211,8 @@ wp_lua_scripting_api_init (lua_State *L)
|
|||||||
node_new, node_methods);
|
node_new, node_methods);
|
||||||
wplua_register_type_methods (L, WP_TYPE_IMPL_NODE,
|
wplua_register_type_methods (L, WP_TYPE_IMPL_NODE,
|
||||||
impl_node_new, NULL);
|
impl_node_new, NULL);
|
||||||
|
wplua_register_type_methods (L, WP_TYPE_LINK,
|
||||||
|
link_new, NULL);
|
||||||
wplua_register_type_methods (L, WP_TYPE_CLIENT,
|
wplua_register_type_methods (L, WP_TYPE_CLIENT,
|
||||||
NULL, client_methods);
|
NULL, client_methods);
|
||||||
wplua_register_type_methods (L, WP_TYPE_SESSION_ITEM,
|
wplua_register_type_methods (L, WP_TYPE_SESSION_ITEM,
|
||||||
|
@@ -120,6 +120,7 @@ SANDBOX_EXPORT = {
|
|||||||
SpaDevice = WpSpaDevice_new,
|
SpaDevice = WpSpaDevice_new,
|
||||||
Node = WpNode_new,
|
Node = WpNode_new,
|
||||||
LocalNode = WpImplNode_new,
|
LocalNode = WpImplNode_new,
|
||||||
|
Link = WpLink_new,
|
||||||
ImplSession = WpImplSession_new,
|
ImplSession = WpImplSession_new,
|
||||||
Pod = WpSpaPod,
|
Pod = WpSpaPod,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user