0 votes
by (2.7k points)

For some reason, given that $Map is an array defined in StoryInit with several rows and columns, the following does not work:

<<for _i to 0; _i lt $Map.length; _i++>>
Row _i: <<print $Map[_i]>><br>

It does not return an error, it just prints nothing. Please help, I have never used the <<for>> macro before, but I need it for this.

1 Answer

0 votes
by (68.6k points)
selected by
Best answer

There's nothing obviously wrong with your code.  Even if the array's contents were non-printable, you should at least be seeing the Row #: part for each member.  If you're not seeing anything at all, then I'd check the status of your array.

Try placing something like the following just above the loop:

$$Map.length: $Map.length

If it doesn't show a value greater than 0 (zero), then that's your problem.

by (2.7k points)
Tried it, and found out what the problem was... I was using this code in a passage called Map. Since I was using Twee2 on a large project, I did not notice that lower down there was another passage called "Map" with only code inside. So that was what displayed, not the passage with the <<for>> loop inside! Sorry for wasting your time.