libubox/examples
Xiongfei Guo 79b56268b4 Added fd_add method for uloop lua binding.
Use uloop.fd_add like this:

    local socket = require "socket"

    udp = socket.udp()

    uloop.fd_add(
        udp, -- socket
        function( -- callback function
            ufd,    -- socket object when register the fd
            events  -- uloop events. eg. uloop.ULOOP_READ .
        )
            local words, msg_or_ip, port_or_nil = ufd:receivefrom()
            print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words)
        end,
        uloop.ULOOP_READ -- event you want to listen
    )

The `examples/uloop-example.lua` show an example of this work.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
..
blobmsg-example.c blobmsg-example: fix length handling in dump_table() calls 2013-09-11 17:59:33 +02:00
CMakeLists.txt runqueue: add a simple task queueing/completion tracking implementation 2013-05-09 01:10:00 +02:00
runqueue-example.c runqueue: move completion handler from runqueue_process to runqueue_task to make it more generic 2013-05-09 01:27:45 +02:00
uloop-example.lua Added fd_add method for uloop lua binding. 2014-06-24 14:30:30 +01:00
uloop_pid_test.sh add an example script for the uloop lua binding 2012-09-27 13:47:46 +02:00
ustream-example.c ustream-example: fix container_of type errors 2013-05-09 01:06:55 +02:00