Names functions work great, you just need to declare them before using them
(unlike in js where function declarations are hoisted to the top of the
block)
local function onInterval()
print "tick"
end
require('uv').new_timer():start(1000, 1000, onInterval)
Keep in mind that `function name() ... end` syntax in lua is just sugar for
`name = function () ... end`. Function literal expressions and variables
referencing functions are interchangeable as callback parameters.
On Tue, Apr 26, 2016 at 6:39 PM, Russell Haley <[email protected]> wrote:
> I have a Digi CoreConnectWMX53 (single core Freescale Arm v7), A Solid Run
> hummingboard with the dual-core pro (Freescale IMX6) and recently purchased
> a Begalbone Black (older TI Sitara) for testing with Minix3.
>
> I would like to support FreeBSD 11, Debian Jessie GNU/Linux, Minix3
> (through the NetBSD userland) and Windows 10 when it's available for the
> Rpi3 (that I haven't saved enough allowance for yet!).
>
> So far, it seems from my research most polling/event queue libraries are
> heavily geared towards Network I/O. I am still heavily researching this
> area as it's important to me. I will need to look into what POLLPRI means.
>
> Any idea about the anonymous function calls in my previous message? I
> couldn't make it work the other night with named functions, but it was
> late...
>
> Thanks!
> Russ
>
> On Tuesday, April 26, 2016 at 4:18:42 AM UTC-7, Tim Caswell wrote:
>>
>> What device are you using that has exposed GPIOs? I've worked in the
>> past with raspberry pis and Linux.
>> On Apr 25, 2016 7:19 PM, "Daurnimator" <[email protected]> wrote:
>>
>>> On 26 April 2016 at 10:14, Russell Haley <[email protected]> wrote:
>>> > Wow, so this is pretty awesome stuff. I am looking at using lua to
>>> read GPIO
>>> > and there have been two basic solutions from my Lua expert friend:
>>> >
>>> > 1) Use select or a Lua binding thereof (luasys, luaev)
>>> > 2) Use Luv!
>>> >
>>> > Do you think GPIO is applicable to Luv?
>>>
>>> Waiting for GPIOs is done on linux via polling the sysfs fd for POLLPRI.
>>> IIRC, libuv *doesn't* support POLLPRI.
>>>
>>> You can still use libuv in combination with another polling library
>>> that support POLLPRI though.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "luvit" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "luvit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"luvit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.