A lightweight async function binder, named after only the most loved virtual youtuber, Kagura Mea.
lit needs to be installed in your system, to install kagura-mea please run the following command:
lit install alphafantomu/kagura-mea
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)();
You can find her socials here:
There is no affiliation with Kagura Mea.
- Discord:
Arivistraliavatoriar#2678