mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
file: Use io.lines
This commit is contained in:
parent
b7c6514bc8
commit
318e737a08
6
file.lua
6
file.lua
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user