Lua-CSP (Work in Progress)

Frank Mitchell

Posted: 2023-07-12
Last Modified: 2023-07-13
Word Count: 119
Tags: lua programming

Table of Contents

Until I can spec this out properly, I’ll just quote an old post:

Programming in Lua, 4th Edition ended with an example of multiple Lua interpreters, each in its own OS thread, sending text messages to each other. I can refine that into a module for “Channels”, “Messages”, and “Processes” (POSIX or C11 threads, since Lua already has cooperative single-process Threads). Combined with a non-blocking IO module one could implement any kind of server with worker threads or chained stages: HTTP, message queue, pub/sub, etc. All you’d need are the underlying modules and some Lua scripts. (Maybe a configuration file to tie it all together.)1

  1. Fellow survivors of Bang Networks in San Francisco may find the idea disturbingly familiar. ↩︎