Modifying Signal module to remove cyclic references

Hello, I’m using this Signal module. The signals create a linked list that stores references to their connections, but the connections themselves contain a reference to their signals, which creates a cyclic table. Thus, I can’t store objects containing connections. Can anyone look through the source code and find a way to circumvent this?

Printing a connection:

1 Like

What are you trying to do exactly? Where do you store them?

What I said was a little vague and incorrect. I meant “send them through events.”

I’m making a custom tool system, and I need to track which tool the player is currently holding. When a player switches tools, an client-side BindableEvent is fired with the new active tool (containing all the connections and other stuff), which is used for updating the HUD.

I was reading over my code a little, and I realized how big of a coupled mess the base tool and the player loadout modules are. I can likely rewrite the entire thing to not have to deal with cyclic tables, but I’d still like to know how to modify the Signal module to prevent connections from storing cyclic references to themselves for the future.