m-lua-scripting: Add attach_collection(), get_collection_name() and get_global_properties() APIs for global proxies

This commit is contained in:
Julian Bouzas 2026-04-24 11:50:33 -04:00
parent 076dd5d4c1
commit 9d5c5c3fca

View file

@ -568,6 +568,15 @@ static const luaL_Reg proxy_methods[] = {
/* WpGlobalProxy */
static int
global_proxy_get_global_properties (lua_State *L)
{
WpGlobalProxy * p = wplua_checkobject (L, 1, WP_TYPE_GLOBAL_PROXY);
WpProperties * props = wp_global_proxy_get_global_properties (p);
wplua_pushboxed (L, WP_TYPE_PROPERTIES, props);
return 1;
}
static int
global_proxy_request_destroy (lua_State *L)
{
@ -576,8 +585,29 @@ global_proxy_request_destroy (lua_State *L)
return 0;
}
static int
global_proxy_attach_collection (lua_State *L)
{
WpGlobalProxy * p = wplua_checkobject (L, 1, WP_TYPE_GLOBAL_PROXY);
WpCollection * c = luaL_opt (L, wplua_toobject, 2, NULL);
wp_global_proxy_attach_collection (p, c);
return 0;
}
static int
global_proxy_get_collection_name (lua_State *L)
{
WpGlobalProxy * p = wplua_checkobject (L, 1, WP_TYPE_GLOBAL_PROXY);
const gchar *collection_name = wp_global_proxy_get_collection_name (p);
lua_pushstring (L, collection_name);
return 1;
}
static const luaL_Reg global_proxy_methods[] = {
{ "get_global_properties", global_proxy_get_global_properties },
{ "request_destroy", global_proxy_request_destroy },
{ "attach_collection", global_proxy_attach_collection },
{ "get_collection_name", global_proxy_get_collection_name },
{ NULL, NULL }
};