Yep buttons can do AddRow()
and DeleteRows()
(for deleterows, you often take a whole table inside the brackets and then .filter() it down to the row or rows you want to delete).
However, you might want to think about a different structure. I’m not totally sure how the player modifier works in your game, but a common way to address the situation of “Table A’s rows are related to Table B’s rows in specific ways” is to make a 3rd table to hold the relationships.
So you would have a Modifiers table with a column for player, a column for weapon, and other columns that are specific to the relationship (damage multiplier or something?). Those first two columns would be Relation columns, referencing rows in the player and weapon tables.
So when you need to establish a relationship between a weapon and a player, create a row here (depending on how your game works, you might use this design pattern for all purchases even, rather than the method you were using before).
You can also, back in the weapons and players table, add a column that shows anything in Modifiers that references that weapon or player, so it’s bidirectional.
Basically when relating objects to one another, you have to think: do I only need to log THAT they are related, or so I need to log further information ABOUT their relationship? If the former, directly link them with a relation column. If the latter, make a table of relationship records.