inkjs
inkjs copied to clipboard
Dynamic Tags are generated in reverse order
Describe the bug
Using Dynamic Tags inside Choices causes the Tag string to be generated in reverse order. (i.e. #tag {var1}{var2}
becomes var2var1tag
)
To Reproduce
Create a Dynamic Tag inside of a choice. (i.e. +[choice #tag {var1}{var2}
]
Expected behavior
The Tag string should be generated in the correct order.
Environment
- OS: Windows
- Web browser version: Firefox 123
- inkjs version: 2.2.2
Additional context
In Ink, Dynamic Tags are generated by iterating over a stack, namely contentStackForTag
in Story.cs
. Because the output stream is iterated over in reverse order this makes sense, as the first element pushed to the stack is the last element removed. This same variable in inkjs is an array, and thus when iterated over, the last element pushed to the array is also the last that is appended to the string.
Thanks for the report !
Fixed in next release 2.2.3