HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
majek
lua-channels
Lua2013–2016
majek / lua-channels

lua-channels

Go style channels in pure Lua

4Distinct people
6Mentions
0Explicit recommenders
141GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Go style channels in pure Lua

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year6 dated mentions

Observed mentions: 2013-09-04 18:44:21 UTC to 2016-05-17 15:31:56 UTC.

0123452013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC514
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC000
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101

What Hacker News says

6 sources
> 2. Python's runtime is completely and utterly incapable of threading. Threading being almost essential to any decent user interface, this whole idea falls flat. While you're AFAIK correct about running Python on mobile devices, and I think anyone will admit that Python's performance has never been great, one can have a great UI without threads: use coroutines and channels instead. Fortunately, Python does have coroutines, and a channel library can be built in the fashion of Lua's channel library (https://github.com/majek/lua-channels). I don't know if anyone has done it yet, I'll grant, but a cursory look suggests that it's possible. The basic idea is that one would spawn a coroutine to handle each UI element, and the coroutines would send messages to one another on channels. I've no idea how fast it would be (at a guess: terrible), b
Read the rest
ut it should work.
In Thoughts on the future of Python and graphical interfaces
I'll do my best, but it's a bit hard to explain. Basically channels are yet-another synchronization paradigm like locking or shared memory, some people like it some don't. Channels are an implementation of Hoare's CSP [0]. Channels can be passed around, the same could be said about Lua coroutines. But with channels you get more flexibility: - you can "block" on many channels at once using the "chanalt" statement. You can "resume" only one lua coroutine at a time. - channels they can buffer messages (ie: channels can queue several values) - many coroutines may "send" a value to a channel at the same time, many coroutines may try to "listen" (receive) a value at the same time. - finally you can pass a channel over a channel I find channels, as opposed to many other synchronization paradigms, to be composable and generally nice in use. It's
Read the rest
a "better" alternative to synchronization locking and mutable data. But in Lua, of course, there aren't multiple threads so why synchronization is useful? In the same way that coroutines are useful - they allow you to decompose a program into set of smaller programs. The example given by Russ Cox is the Eratosthenes sieve. You can read about it [1] or watch him talking about it [2], finally my implementation following his talk [3]. [0] https://en.wikipedia.org/wiki/Communicating_sequential_proce... [1] http://swtch.com/~rsc/thread/ [2] http://www.youtube.com/watch?feature=player_detailpage&v=hB0... [3] https://github.com/majek/lua-channels/blob/master/sieve.lua
In Go style Channels for Lua
Author here. Here's some context [1]: Lua supports cooperative coroutines out of the box, which is great. Unfortunately Lua lacks built-in communication primitives. To fill the void I've implemented Go style channels in pure Lua. Of course abstract channels without any concurrent IO aren't terribly useful, but fortunately the code is pretty straightforward and adapting it to your event loop shouldn't be a problem. The code is ~400 lines of code + ~200 of tests. For example, here's [2] Eratosthenes sieve following Russ Cox explanation [3]. [1] http://lua-users.org/lists/lua-l/2013-08/msg00546.html [2] https://github.com/majek/lua-channels/blob/master/sieve.lua [3] http://swtch.com/~rsc/thread/
In Go style Channels for Lua

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.