Data?

I’m listing this as a suggestion, because I don’t think you can do this now (99% sure) - if I’m wrong, I’d love to hear it.

Is there a way to have a “data” file? Like a class tab, but rather as freeform data? In my particular case, I have font data that looks like this:

1  9MWRMNV RRMVV RPSTS
2 16MWOMOV ROMSMUNUPSQ ROQSQURUUSVOV
3 11MXVNTMRMPNOPOSPURVTVVU

These are the Hershey Font letterforms - I have like 4000 of them (with all sorts of fonts and greek characters and japanese and so on). Too much to want to wrap in a lua syntax (in part because some of them have characters I’d have to escape) - what I’d really like to do is be able to import them unchanged, open them as a file, and read/parse them into data structures. Ideally, Codify would recognize these as “not lua” and not do the selector stuff on them as well.

Not a high priority - I actually rather suspect when real fonts come along, the vector fonts will be uninteresting - but I can think of lots of cases where a freeform data text file would end up being handy.

At the moment you can’t - you’re right. I disabled access to the filesystem for security reasons.

The most minimal “wrapping” syntax I can think of would be Lua’s multi-line strings. You can use double square brackets to wrap strings over multiple lines, as follows:

fontData = [[1  9MWRMNV RRMVV RPSTS
2 16MWOMOV ROMSMUNUPSQ ROQSQURUUSVOV
3 11MXVNTMRMPNOPOSPURVTVVU]]

You could then split the data on newlines to get the individual lines.

Edit: ah missed that part about needing to escape characters, but [[…]] might do this. From the Lua reference manual:

Literal strings can also be delimited by matching double square brackets [[ · · · ]]. Literals in this bracketed form may run for several lines, may contain nested [[ · · · ]] pairs, and do not interpret any escape sequences. For convenience, when the opening ‘[[’ is immediately followed by a newline, the newline is not included in the string. As an example, in a system using ASCII (in which ‘a’ is coded as 97, newline is coded as 10, and ‘1’ is coded as 49), the four literals below denote the same string:

Heh - I tried the “[[ ]]” syntax - and it barfs (I don’t exactly understand why!) on a line that ended with a “]” character (it sees the first two "]"s of “]]]” as the closing quote, not the last two). I can go to “[=[” quoting, but I kinda feel like I’m going down the rabbit hole there…

I’m not interested in filesystem access (well, I am, but that’s another thing) so much as a place to put unformatted data.

I think I’m going to work around the escaping issue by re-encoding the data in a nice friendly format - probably hexadecimal. I’m even contemplating doing enough work to have a nice, encoded and compressed (base 64) data block, on multiple reasonably-short lines so the editor is happy, and routines to wrap it. That would presumably be useful for other things. Hee hee - maybe a virtual filesystem (or file, at least) - why not?