I'm using Tweego w/ sugarcube v2.25.0. I have a widget that handles the function of handling items, for simplicity's sake I'm stripping it down. As even then it doesn't function correctly, I'll also add that running the exact same line of codes in Twine 2(the software) w/ sugarcube 2.21.0 has it working flawlessly.
Here's the code that sets variables and calls on the widgets in question <<buy>> & <<Sell>>, The div classes are because I'm using CSS to sort the text into grids
<div class="items">
<<ItemSnacks>> /* widget */
<<print _retailValueCS.Snacks>>$
</div>
<div class="items">
<<button "Buy">>
<<set _selectedItem to "Snacks">>
<<Buy>> /* widget */
<</button>>
</div>
<div class="items">
<<button "Sell">> /* widget */
<<set _selectedItem to "Snacks">>
<<Sell>>
<</button>>
</div>
Clicking either button calls on the widget <<Buy>> or <<Sell>>. Here are the widgets
<<widget "Buy">>
<<set $pc.inventory.pushUnique(_selectedItem)>>
<</widget>>
<<widget "Sell">>
<<set $pc.inventory.delete(_selectedItem)>>
<</widget>>
Their actually supposed to handle more code, but i've stripped it to simplify the issue. The problem here is that .pushUnique() doesn't work properly in Tweego. In Twine 2(software) it's works fine.
After "Snacks" has been pushed into $pc.inventory. It's strings are pushed out like this;
<<print $pc.inventory>> becomes: Wallet, Knife, Snacks, Snacks, Snacks.
Which is not correct, in Twine 2 the same command pushes "Snacks" only once and multiple click doesn't add more.
Funnily enough, the <<Sell>> Widget functions correctly, it's .delete() delete any strings matching it's definition. But .pushUnique doesn't work. It's not unique, I can do .push() and it works fine but add unique and it still works but not with it's intended purpose.
Any help I can get here as to understanding why this happens?
Edited to make it slightly less horrifying to read the code snippets