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.
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
“some more 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]