lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I do not have a suggestion for anything that already exists, but I do think something really powerful could be done with a coroutine scheduler for Lua.

For example, I would like to be able to say "yield this coroutine until some real-time criterion is met" ( yield(for 10 seconds), or yield(until packet received OR 20 seconds has elapsed) ). This would enable a style of single-threaded real-time programming similar to that offered by http://www.nodejs.org/ (event driven), except that scheduling coroutine resumes would be so much more powerful than just scheduling function execution (as in node.js) because it would maintain procedural context.

I did some thinking about this idea, including a conceptual design for such a scheduler, but never progressed it as far as code. Although Javascript is an ugly brute compared to Lua, it does have the "killer advantage" of being baked into every browser, meaning that with browser/node.js fusions like https://github.com/rogerwang/node-webkit you can write your front end and backend code in the same language.

But that coroutine scheduling idea is just so technically sweet ...

> ------------------------------
>
> Message: 6
> Date: Mon, 24 Feb 2014 12:10:08 +0100
> From: Teto <mattator@gmail.com>
> Subject: Coroutine library scheduler
> To: Lua mailing list <lua-l@lists.lua.org>
> Message-ID:
> 	<CADHp1NxsTQwt4id1VgL7F1p_jpHZwRy4DX-
> k56uA7=Znvxap0g@mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hi,
>
> I am looking for a coroutine library that is able to :
> -handle dependancies between coroutines. For instance, a coroutine can
> be a child of another one, if I remove its daddy, it should die. The
> child coroutine could also block the daddy coroutine.
> -reuse these coroutines (I read it could improve performance)
>
> I've started created something like that (for a game) but I would
> prefer using a robust,well-tested implementation. Is there any or is it
> too specific ?
>
> Regards
> Matt
>
>
>
> ------------------------------


---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com