Giving new value properties to tables

I’m getting an error that doesn’t make any sense to me. Inform perfectly well lets me give tables an additional value:

A table has a number called the line number. The line number of a table is usually 1. 

But if I actually try to use the value, it gives me the error “In the sentence ‘let N be the line number of T’ , you seem to be looking up the ‘line number’ property, but ‘table name’ is not allowed to have that property.” But how can tables not be allowed to have that property when I just gave them that property with no trouble?

To display the line number of (T - table name): let N be the line number of T; say "You are on line [N] of [T]."

There isn’t a kind of value called “table”: the one corresponding to tables is “table name”. If you wanted to give a table a property you’d need to write

A table name has a number called the line number.

which Inform rejects saying this kind of value can’t have properties. If you check the Index, you’ll see that your code is actually creating a thing called “table” (and giving it the property). This is similar to how the sentence “A rock is on the table.” will create two objects “rock” and “table”, without you having to assert their existence explicitly: Inform infers that the objects must exist (and in fact that the table must be a supporter).

Bummer, I wondered if there were type shenanigans going on between “table” and “table name.”

I was just trying to make a variable to keep track of where I am in a table; the game needs to proceed down various tables turn by turn but sometimes pauses or backs up. Giving the table a variable seemed the easiest way. What alternatives are there? I’ve got enough tables that it’s unwieldy to manually create a separate variable for every table.

You could have a table whose columns are “table name” and “position”.

Trying that, but it’s not cooperating. Why won’t it let me select a line number from that table?

[code]The test room is a room.

Table 1.1 - Line Numbers
Table Line Number
Table 1.2 1
Table 1.3 1

Table 1.2
“some text”
“some more text”

Table 1.3
“some text”
“some more text”

To print the current line of (T - table name):
let N be the line number corresponding to a table of T in Table 1.1;
if there is a sentence in row N in T:
say “[sentence][paragraph break]”;
if N is not the number of rows in T:
now the line number corresponding to a table of T in Table 1.1 is N + 1.[/code]

Does that code give a compile error or a runtime error or what?

Compile error:

I don’t really see what’s different about this than 16.3 in the documentation.

I’m not sure what that quirk of syntax is, but this works:

	choose row with table of T in the Table of Line Numbers;
	let N be the line number entry;

The following stuff seems to be redundant too – you’re choosing a row in T twice, which can probably be simplified, but I haven’t worked it all through.