mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +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)
|
function process_bridge_listen(name, line_consumer, step)
|
||||||
local bridge = process_bridges[name]
|
local bridge = process_bridges[name]
|
||||||
modlib.minetest.register_globalstep(step or 0.1, function()
|
modlib.minetest.register_globalstep(step or 0.1, function()
|
||||||
local content = io.open(bridge.input, "r")
|
for line in io.lines(bridge.input) do
|
||||||
local line = content:read()
|
|
||||||
while line do
|
|
||||||
line_consumer(line)
|
line_consumer(line)
|
||||||
line = content:read()
|
|
||||||
end
|
end
|
||||||
content:close()
|
|
||||||
write(bridge.input, "")
|
write(bridge.input, "")
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user