I am currently designing a complex turn-based system, and I need effects like passives and status effects to be able to trigger at different times, such as when a one combatant attacks another or when the player plays a card. I am making a system of calls and responses, where I construct a call object containing information about the action that is about to occur, including the function for it, and then iterate over a folder of responders running a check function in each one to see if they need to respond to the call, and if so, modifying the call in some way, such as adding a function to be run after it’s main effect, or adding a modifier to change damage, ect. To this end, I don’t want the responder table to be in charge of handling things like status effects for organizational purposes, but I need a convenient way to determine which responder is tied to which source, so that they can be removed when the effect expires. Right now I am using empty tables as keys to achieve this. When an effect is created, I make an empty table to serve as the key for both the source of the effect, wherever it’s from, and as the key for it’s corresponding responder item.
I accept any and all feedback regarding my method, but my main question is, would this be a bad practice to use empty tables as keys? I am not technically informed enough to know if doing this would cause significant problems when scaled up, as it’s likely that across a server there will be several hundred instances of these empty tables being used to track lots of status effects.