Hi,

I've been using awesome-client with success to execute some lua code
through dbus, but I'm wondering how to obtain a reply from this code.

If I have a function like this un my rc.lua file:

    dbus_test = function()
        -- do something...
        
        -- let's try to return a value
        return "test"
    end

when I call it through dbus, I dont get any response. The code is
executed, but the return statement is not handled properly, a dbus
reply is not generated (awesome-client is calling dbus-send
with the argument --print-reply):

    $ echo "dbus_test()" | awesome-client

I would expect the following output:

    $ echo "dbus_test()" | awesome-client
       string "test"

After digging in /usr/share/awesome/lib/awful/remote.lua, I can see
how the call is made: 

    dbus.add_signal("org.naquadah.awesome.awful.Remote", function(data, code)
        if data.member == "Eval" then
            local f, e = loadstring(code)
            if f then
                results = { f() }    <-- call is made here
                ...

But the results table is always empty, and I don't understand
why. If anyone have an idea or a proper example how to get a reply
from a dbus call, I would appreciate.

My version of awesome:

    awesome v3.4.15 (Never Gonna Give You Up)
     • Build: Feb 17 2013 21:10:46 for x86_64 by gcc version 4.7.2 
(buildd@barber)
     • D-Bus support: ✔
    
-- 
Gerome Fournier
http://foutaise.org

-- 
To unsubscribe, send mail to [email protected].

Reply via email to