CCAsync

Asynchronous engine for ComputerCraft



CCAsync is an asynchronous engine made for mostly multitasking projects.

The event API will help you manage events and timings better thanks to coroutines.

Usage:

async <file> [args [...]]


Example of async program:

event.on("mouse_click", function(_,x,y)
  print("You clicked at X"..x.." Y"..y)
end)

event.on("key",function(key)
  if key == keys.space then
	local terminable = event.isTerminable()
	local newValue = not terminable
	event.terminable(newValue)
	print("Terminable: "..tostring(newValue))
  end
  if key == keys.backspace then
	print("Closing...")
	event.exit()
  end
end)

local function charHandler(char)
  print("You pressed: "..char)
  event.setTimeout(function(arg)
	print("You pressed "..char.." 2 seconds ago")
	print("This is a random arg: "..arg)
  end,2, "random arg")
end
event.on("char",charHandler)

Install:

wget https://raw.github.com/Ale32bit/CCAsync/master/async.lua async.lua


Full API: https://github.com/A...aster/README.md