Trigger data, default data and ownership needs clarification #9

Open
opened 2026-06-24 15:14:19 +00:00 by omicron · 0 comments
Owner

Each trigger has data that is sourced from a combination of the triggering source and default data. While working on an update to the AuraTrigger code I found some consistency issues in how these interact. When Trigger:SetData(data) is called, Trigger assumes ownership of the passed table and modifies it with the contents of defaultData. It then sets the Trigger data to this newly passed and modified table.

This is potentially an issue for multiple auras triggering the same trigger, unless we make lots of shallow copies of the data tables. Consider the following scenario:

  • aura with instance id 1 gets added to the trigger and it activates. The trigger data is set to this instance's data table but it's also modified with the default data
  • aura with instance id 2 gets added to the trigger and takes precedence according to some ordering, this trigger's data table is now passed to Trigger:SetData and also modified

Maybe it's not a real issue, but it feels odd to modify the data source tables this way. Something to think about.

Each trigger has data that is sourced from a combination of the triggering source and default data. While working on an update to the AuraTrigger code I found some consistency issues in how these interact. When Trigger:SetData(data) is called, Trigger assumes ownership of the passed table and modifies it with the contents of defaultData. It then sets the Trigger data to this newly passed and modified table. This is potentially an issue for multiple auras triggering the same trigger, unless we make lots of shallow copies of the data tables. Consider the following scenario: - aura with instance id 1 gets added to the trigger and it activates. The trigger data is set to this instance's data table but it's also modified with the default data - aura with instance id 2 gets added to the trigger and takes precedence according to some ordering, this trigger's data table is now passed to Trigger:SetData and also modified Maybe it's not a real issue, but it feels odd to modify the data source tables this way. Something to think about.
omicron added the Kind/Internals label 2026-06-24 15:14:19 +00:00
Sign in to join this conversation.