Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Extra line in table

Hi,

I'm tearing my hair out. I try to understand what i'm doing wrong to have a extra line in my table.

I use Sugarcube and twine 2.

The story init contains:
<<set $shop =[
{name: "Sword", price:10, dice: "1D4", bm: 0},
{name: "Axe", price: 12, dice: "1D4", bm: 1}
]>> 

and passage:
<table>
<tr>
<th>Item</th><th>Weapon</th><th>Price</th><th>Hit points</th><th>+/ -</th>
</tr>
<<for $i to 0; $i lt $shop.length; $i++>>
<tr>
<td><<print ($i + 1)>></td>
<td><<print $shop[$i].name>></td>
<td><<print $shop[$i].price>></td>
<td><<print $shop[$i].dice>></td>
<td><<print $shop[$i].bm>></td>
</tr>
<</for>>
</table>

<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
work's fine without loop.

an idea ? (if you can see what's happen in html)

Comments

  • edited June 2015
    Put a backslash after the </tr> directly above your loop. I tested that and it worked for me.

    EDIT: Crap! I tested that in Twine 1.4.2 since I failed to notice you were using Twine 2. It worked in Twine 1, but not in Twine 2.

    However, using more backslashes did work:
    </tr>\
    <<for $i to 0; $i lt $shop.length; $i++>>\
    <tr>\
    
  • Thank's Sharpe, that work's.

    I only need to escape for line:
    <<for $i to 0; $i lt $shop.length; $i++>>\
    
Sign In or Register to comment.