Skip to content

A lightweight async function binder, named after only the most loved virtual youtuber, Kagura Mea.

License

Notifications You must be signed in to change notification settings

alphafantomu/kagura-mea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kagura-mea

A lightweight async function binder, named after only the most loved virtual youtuber, Kagura Mea.

Installation

lit needs to be installed in your system, to install kagura-mea please run the following command:

lit install alphafantomu/kagura-mea

Usage

The library returns a function which will be used to wrap synchronous functions, an example using coroutines is shown below:

local async = require('kagura-mea').async;

local waitFive = async(function(n)
	local uv = require('uv');
	local t = uv.thread_self();
	uv.sleep(5000);
	return nil, n * n, n;
end);

coroutine.wrap(function()
	local thread = coroutine.running();
	waitFive(5, function(...)
		print(...);
		coroutine.resume(thread);
	end)
	print'got here';
	coroutine.yield();
	print'woohoo';
end)();

coroutine.wrap(function()
	local thread = coroutine.running();
	waitFive(5, function(...)
		print(...);
		coroutine.resume(thread);
	end)
	print'got here';
	coroutine.yield();
	print'woohoo';
end)();

Kagura Mea

You can find her socials here:

Disclaimer

There is no affiliation with Kagura Mea.

License

MIT License

Contact

  • Discord: Arivistraliavatoriar#2678

About

A lightweight async function binder, named after only the most loved virtual youtuber, Kagura Mea.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages