summaryrefslogtreecommitdiff
path: root/script/async/loadfile.lua
blob: b9d0f41cf5a817df61272ff39a13a4d3d7fbd08e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'utility'
local fs = require 'bee.filesystem'

while true do
    local filename, mode = IN:bpop()
    local buf = io.load(fs.path(filename))
    if buf then
        OUT:push(filename, mode, buf)
    else
        ERR:push('Load failed:' .. filename)
    end
    GC:push(ID, collectgarbage 'count')
end