Heyo Inventory Help

Twine 2
Halowe

Hey I’ve been trying to setup a inventory for this game

ryna make, and i dont quite understand it ive been just trying to be able to buy something and have it show up in your inventory. This is the code i “nicely and ethically took”

The inventory page:
(if: (passage:)'s name is “inventory”)[]
(set: $inventory to (a:))
(for: each _item, …$inventory) [
(print: _item + " ")
]

(hidden:)[
(set: $Donut to (dm:
“id”, 1,
“name”, “Donut”,
“description”, “A scrumptious desert.”,
))

(set: $IronSword to (dm:
“id”, 2,
“name”, “Iron Sword”,
“description”, “A Generic Iron Sword”,

))

]
(link-goto: “Close”, (history:)'s last)

Listing:

(set:$money to it -10)
(set: $inventory to $inventory + (a: $IronSword))
[[Continue->AShop]]

It works that it subtracts money but it doesn’t actually show in your inventory