Don’t know how much use anyone else has for this, but here’s a little module that lets you load a file during preinit and assign the contents to an object property: fileToProp github repo.
I use this for things like in-game documentation. For example, including a copy of the licence the game is distributed under.
Syntax is straighforward:
someProp = nil
+FileToProp 'fileName.txt' ->(&someProp);
This will load the contents of
fileName.txt and assign them to
someObject.someProp. The module assumes strings, but it could be easily extended to other datatypes if needed for some reason.
The file path is the default path for the compiler, which for FrobTADS under linux means the directory the compiled story file ends up in.
The file needs to be present during preinit, which means compile time for normal builds and runtime for debug builds.
This is pretty trivial code—it’s only like a hundred lines including comments—but I like being able to load things like the licence text, credits, and so on from flat files instead of having to format them in the game’s code.