Quenty/NevermoreEngine

Signal doesn't support fire'ing inside listeners and doesn't use table.pack

lucasmz-dev opened this issue · 0 comments

Feel like the Signal module should be slightly rewritten, maybe add :ConnectParallel functionality?
I don't use NevermoreEngine I just steal some assets from it to use from time to time.

using table.pack and table.unpack is slightly faster than checking all of that using select('#', ...)
Edit: You still need to specify the other arguments, so

local args = table.pack("A", nil)

{
    n = 2 --\\ numbers of arguments
    [1] = "A",
}

table.unpack(args) -- > "A"

table.unpack(args, 1, args.n) -- > "A", nil

--\\ Using table.pack instead of having a custom function IS faster in my testing.

And like I said it doesn't support :Fire'ing inside connections because the arguments will glitch out if so.
The solution to this is to have argument data be set to a #self + 1 index and send that to the actual connection, I did that with my small library and it worked just fine. I believe Knit does that with it's Signal too.

Your Signal API atm seemes like it should break with Deffered events, (as having a fire happening while another fire is happening, would replace the arguments and therefore cause it to give unaccurate arguments)