Macro FOREACH to tag [foreach]

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: Macro FOREACH to tag [foreach]

Post by Toranks »

Thanks for the info!
What Ravanal said is correct, I was evaluating the optimistic case and it did not occur to me to check if it was ever negative, when I was doing tests. I was desperate with the $ issue because nothing worked for me, until @gnombat told me that the problem was in [unstore_unit]
Celtic_Minstrel wrote: December 1st, 2022, 2:21 am (By the way, since it's a plural name, is that an array variable? If that's the case you should really write patients[0].whatever instead of patients.whatever. The two are equivalent, but the first form makes it clear that you know it's an array.)
No, the array variable is patient_units. patients is the variable for every element of the array variable that uses [foreach] on each iteration.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Macro FOREACH to tag [foreach]

Post by Celtic_Minstrel »

I'd recommend calling it patient then. Using a plural name for a singular variable is just going to confuse people.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply