From 0ccda0eb9e6000b175205a82d65e47d257f71b0b Mon Sep 17 00:00:00 2001 From: Da Risk Date: Fri, 2 Jan 2015 20:07:22 +0100 Subject: [PATCH] Add luadoc for dbus.emit_signal() --- dbus.c | 9 +++------ luadoc/dbus.lua | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/dbus.c b/dbus.c index 2f5dba1e..a953a98d 100644 --- a/dbus.c +++ b/dbus.c @@ -812,16 +812,13 @@ luaA_dbus_emit_signal(lua_State *L) const char *path = luaL_checkstring(L, 2); const char *itface = luaL_checkstring(L, 3); const char *name = luaL_checkstring(L, 4); - lua_remove(L, 1); - lua_remove(L, 1); - lua_remove(L, 1); - lua_remove(L, 1); DBusConnection *dbus_connection = a_dbus_bus_getbyname(bus_name); DBusMessage* msg = dbus_message_new_signal(path, itface, name); DBusMessageIter iter; dbus_message_iter_init_append(msg, &iter); - int nargs = lua_gettop(L); + int top = lua_gettop(L); + int nargs = top - 4; if(nargs % 2 != 0) { @@ -830,7 +827,7 @@ luaA_dbus_emit_signal(lua_State *L) lua_pushboolean(L, 0); return 1; } - for(int i = 1; i < nargs; i += 2) { + for(int i = 5; i < top; i += 2) { if(!a_dbus_convert_value(L, i, &iter)) { luaA_warn(L, "your D-Bus signal emitting method has bad argument type"); diff --git a/luadoc/dbus.lua b/luadoc/dbus.lua index 98894a40..b5b7c3da 100644 --- a/luadoc/dbus.lua +++ b/luadoc/dbus.lua @@ -41,3 +41,17 @@ module("dbus") -- @param func The function to call. -- @name disconnect_signal -- @class function + +-- Emit a signal on the D-Bus. +-- @param bus A string indicating if we are using system or session bus. +-- @param path A string with the dbus path. +-- @param interface A string with the dbus interface. +-- @param method A string with the dbus method name. +-- @param type_1st_arg type of 1st argument +-- @param value_1st_arg value of 1st argument +-- @param type_2nd_arg type of 2nd argument +-- @param value_2nd_arg value of 2nd argument +-- ... etc +-- @name emit_signal +-- @class function +--