BadSignal
Github: here
Basic info
This module focuses on proper coroutine function wrapping rather than speed. As such, it is quite slow compared to other similar signal modules. Hence the name Bad
.
But the name Bad
would only apply if you would improperly connect your signals or use them. This module can surpass the speeds of other modules in some cases.
Example usage
local BadSignal = require("./BadSignal")
local signal - BadSignal:new(1) -- allocate 1 connection
signal:Push(false,print) -- specify if we yield and connect the function itself
signal:Fire(12,"hello","world") -- fire with any amount of args
As you read, you most likely noticed that there are some oddities, like added false
to the connection or the number argument in the constructor. That’s where the power of this module comes in. You can read more about it on github, but those arguments are what can make this module a lot faster than any other solutions out here.
Other signal modules combine thread and direct calling by having a single thread, and in case it yields, they simply create a new one. This one also combines both thread and direct calling but in a much more direct way, allowing for a much faster execution.
Summary
I created this module due to the lack of proper thread safety signals out there. So it is very unconventional in both terms of formatting, OOP model, and execution method. Also, this module requires specific usage in order to be efficient. So it will not fit all of your needs.