lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello all,
I am trying to create a small tool that reads and writes mp3 metadata.
It's really easy. The last 128 bytes of a mp3 file stores the required
information.
In Pascal, the structure representing mp3 metadata is:

type
TID3 = record
signature: array[0..2] of char;
title, artist, album: array[0..29] of char;
year: array[0..3] of char;
comment: array[0..29] of char;
genre: byte;
end;

My first difficult is: how to represent a Lua 128 bytes structure like that.
And how can I read the last 128 bytes of a file and attibutes it to a
structure, probably a table, with this fields, sized with the given
values?
In order words, I don't know what I should use to read and write a set
of bytes in Lua and I don't know how to represent C or Pascal
structures.
Best regards,
Luciano