File format

metatable file is composed from frames and structure of frames written at the end of file. Frames are named, name of frame consists from 4 bytes (there is possibility to have at most 2^32 frames if ever needed). Data itself are stored as sorted set of fixed-size records in data frame. Values of type string are stored in another frame called strs. The last basic frame is indx where „indexes“ are stored.

All integers are stored in big-endian format.

Structure of frames (end of file)

Zero or more frame triples (name : string4, size : integer, used : integer) followed by count of frames frame_count : integer. Then version of metatable format format_version : integer and at the end of string "metatable":

(name : string4, size : integer, used : integer)*
frame_count : integer
format_version : integer

data frame

Fixed-size records, each record 256 bytes long:

Records are stored in ascending order by row and col.

strs frame

Raw value of strings stacked up one after another. Have to be referenced from data records.

indx frame

Fixed-size records, each record 128 bytes long:

Fork me on GitHub