Broadcaster attachment design pattern
-
@d-healey Indeed, indeed.
for (engine in SharedData.engines) { local capturedEngine = engine; SharedData.broadcasters[capturedEngine + "ModeControl"].addListener("string", "metadata", function[capturedEngine](index) { BroadcasterCallbacks.setActiveModeForSlot(capturedEngine, index); }); }
This did seem to work however.
-
@Orvillain Yep that will do it, it's not the most elegant solution but that's what it's designed for.
-
@d-healey More elegant than what I have right now I am thinking!
-
@Orvillain Yep it will certainly help reduce that repetition
-
@d-healey Yeah, I think I can essentially boil down 11 functions down to 3 functions with this. Pretty cool, cheers!