file: Use io.lines

This commit is contained in:
Lars Mueller 2022-07-17 21:33:54 +02:00
parent b7c6514bc8
commit 318e737a08

@ -121,13 +121,9 @@ end
function process_bridge_listen(name, line_consumer, step)
local bridge = process_bridges[name]
modlib.minetest.register_globalstep(step or 0.1, function()
local content = io.open(bridge.input, "r")
local line = content:read()
while line do
for line in io.lines(bridge.input) do
line_consumer(line)
line = content:read()
end
content:close()
write(bridge.input, "")
end)
end