Question about Glulx search opcodes and I7 tables

Hm, I should indeed try looking at the generated I6–I could tell that the phrase can return a value (the run-time error function is returned), but I assumed that the primary intent was not to return anything, but instead to set ct_0 and ct_1.

My memory is that your code didn’t work in my little experiment either, for some reason, but I just tested it bare and it worked nicely. I haven’t had a lot of time to work on this, but I’ll give it some more attention tonight if I can.

Thanks!

–Erik

EDITED TO ADD: And my code seems to work too, when tested bare. (By which I mean in a separate, simplified project; I’m using the Port Royal 4 example.) So I need to approach this differently. I’m not sure how; the functionality of my “select a row” phrase (or your repeat phrase forced to stop after the first found entry) should be identical to the TableRowCorr() routine called by the library’s “choose a row” phrase. Here’s the code that appears to be working:

[code]Include (-
Global seekStartAddress;
Global seekRows;
Global seekVal;
-) after “Definitions.i6t”.

To select a/the/-- row with (TC - a word value valued table column) of (W - a word value) in/from (T - table name):
(- {-require-ctvs}
ct_0 = {T};
ct_1 = -1;
seekStartAddress = ({T})–>(TableFindCol({T}, {TC}, true)) + (COL_HSIZE * WORDSIZE);
seekRows = TableRows({T});
seekVal = {W};
@linearsearch seekVal WORDSIZE seekStartAddress WORDSIZE seekRows 0 4 ct_1;
if (ct_1 < 1) return RunTimeProblem(RTP_TABLE_NOCORR, {T});
-).[/code]

It’s different from the code posted upthread in just one respect: the addition of seekVal; having a bare {W} in the @linearsearch produced a compiler error in my test project, but not my actual WIP. Odd! Anyway, this points me in the right direction…