Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 1.37 KB

README.md

File metadata and controls

41 lines (27 loc) · 1.37 KB

Lua Threading API (designed for CC:Tweaked/ComputerCraft)

This lightweight library designed for Minecraft mod called CC:Tweaked, and allows to run concurrent/pseudo asynchronous threads, using corouitines.

How to install it?

Just place `lib` folder anywhere, and include lib into your project using `require("/path/to/your/lib/folder/lib/thread")`. Any other folder exept `thread` is not required, you can remove them.

Why?

This lib allows you to run many function simultaneously, but unlike parallel, threads can generate new threads and continue running. Since computers in CC:T/ComputerCraft don't have cores, every thread you run, is running one-by-one, creating pseudo asynchronous tasks

Demo:

Demo

How to use:

local thread = require "lib.thread"

Warning!

This library requires to be started anywhere in your code. It is recomended to start master thread in start of your app/os, run your code as a thread.
thread.start()

TODO:

  • Join thread
  • Your idea

Conclusion

Feel free to open an issue, for bug, idea or something. Ask questions on discord: mrvoid__ or matrix chat: @mr-void:hackliberty.org

This library under GPL-3.0 licence.