notes: Your latest example includes the same invalid characters as your previous one, if they are in your actual project then you need to replace them as I indicated. It would also help if you use the Preformatted Text option (in the toolbar) when supplying code examples, it makes them easier to read and to copy-n-paste.
There are a number of issues with your latest example:
1: Your usage of invalid topographical (curly) double quotes is one of the reasons you are seeing that error.
2: The spread operator … (three consecutive full stops) only works with an Array.
If you want to use the (for:) macro with a Datamap object then you first need to use the (datanames: ) macro to obtain an Array containing the names / keys of each of the key/value pairs within that object. You can then use the
(for:) macro to loop through each of those keys.
3: You are hard-wiring the value of the
$InvLength variable instead of interrogating the contents of the
$Inv variable to determine how many ‘items’ it actually contains.
A variation of your example that incorporates the above information, and which also uses HTML
elements to inject line-breaks as needed.
(set: $Inv to (dm: "Sword01", "Votre épée", "Axe01", "Votre hache"))
(set: _names to (datanames: $Inv))
(if: _names's length > 0)[
(append: ?Sidebar)[<br>Vous avez :]
(for: each _name, ..._names)[
(append: ?Sidebar)[<br>- (print: $Inv's (_name))]]