EXPERIMENTAL: Implement file callbacks

This commit is contained in:
Marcel Krüger 2020-07-15 16:36:11 +02:00
parent 7bea04d470
commit 063251b54f
16 changed files with 133 additions and 205 deletions

View file

@ -192,12 +192,9 @@ local function parse_commands(buf, off, t)
until cmd == 245
return off
end
return function(filename)
local f = assert(io.open(filename, 'rb'))
local pk = f:read'a'
f:close()
return function(data)
local res = {}
local off = parse_commands(pk, 1, res)
local off = parse_commands(data, 1, res)
-- assert(off == #pk+1) -- TODO: Check that only fillup bytes follow
return res
end