This is my code that checks a list of states against the active states on a selected token
Code: Select all
[H: tTokenID=getSelected()]
[H: tStateInfo=""]
[H: tStateIcons=""]
[H: tStateList="Blind,Dazed,Deaf,Disabled,Diseased,Hidden,Enraged,Flying,Held,Hidden"]
[R, FOREACH(tIndex, tStateList), CODE: {
[if(getState(tIndex, tTokenID), listAppend(tStateInfo, tIndex), "")]
}]
[R: tStateInfo]
The result is: Blind, , Deaf, , , , , , Held,
Despite the use of an IF statement, it appears that the listAppend is triggered on every FOREACH cycle regardless if a match occurs. I believe my code is fine. That really feels like a bug and not an intended result. I expected a clean list like "Blind, Deaf, Held".
Anyone have an insight? Perhaps my use of listAppend is not correct...?