Howdy, Stranger!

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

Feature request for Harlowe: data matrix

I have searched an issue tracker in Harlowe's repo, but it seems there isn't one. If there's a better way to make a feature request, please point that to me.

Now we have datamaps, that are like tables with two columns and arbitrary rows. I propose a macro we could call datamatrix, which would have both arbitrary rows and columns. A possible syntax could be like this:
(set: $a to (datamatrix:
    ("id", "name", "surname", "gender"),
    ("JC", "Julius", "Caesar", "male"),
    ("MA", "Marcus", "Antonius", "male")
    )
)

The first row that is declared would always be the header row with column names. The first value in each row will be the identifier for that row. A possible syntax for accessing values could be:
(print: $a's ("JC", "name"))

Please notice that this is already possible in Harlowe by nesting datamaps:
(set: $a to (datamap:
    "JC", (datamap: "name", "Julius", "surname", "Caesar"),
    "MA", (datamap: "name", "Marcus", "surname", "Antonius")
    )
)

(print: $a's JC's name)

So what I'm suggesting here is that some functionality that already exists but needs a convoluted syntax, difficult both to write and read, can be presented in a simpler way.

I'm asking because I already used nested datamaps in my first Twine game and I think I'll use them in any future efforts.

Thanks!

Sign In or Register to comment.