Skip to content

🐛Lua-eco is a Lua interpreter with a built-in event loop for scheduling lightweight coroutines automatically, enabling efficient concurrency in Lua. Build high-performance, scalable applications.

License

Notifications You must be signed in to change notification settings

hacklinshell/lua-eco

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lua-eco(中文)

license PRs Welcome Issue Welcome Release Version Build Status visitors

Lua-eco is a Lua interpreter with a built-in libev event loop. It makes all Lua code running in Lua coroutines so code that does I/O can be suspended until data is ready. This allows you write code as if you're using blocking I/O, while still allowing code in other coroutines to run when you'd otherwise wait for I/O. It's kind of like Goroutines.

Lua-eco also provides some modules including timer, file, signal, exec, socket, http, ssl, dns, termios, ubus and so on.

Would you like to try it? Kinda interesting.

#!/usr/bin/env eco

local time = require 'eco.time'

eco.run(function(name)
    while true do
        print(time.now(), name, eco.id())
        time.sleep(1.0)
    end
end, 'eco1')

eco.run(function(name)
    while true do
        print(time.now(), name, eco.id())
        time.sleep(2.0)
    end
end, 'eco2')

Requirements

  • libev - A full-featured and high-performance event loop

Build

sudo apt install -y liblua5.3-dev lua5.3 libev-dev libssl-dev
git clone --recursive https://github.com/zhaojh329/lua-eco.git
cd lua-eco && mkdir build && cd build
cmake .. && sudo make install

TODO

  • websocket

Contributing

If you would like to help making lua-eco better, see the CONTRIBUTING.md file.

About

🐛Lua-eco is a Lua interpreter with a built-in event loop for scheduling lightweight coroutines automatically, enabling efficient concurrency in Lua. Build high-performance, scalable applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 76.8%
  • Lua 22.3%
  • CMake 0.9%