updated
This commit is contained in:
@@ -53,15 +53,17 @@ local function playFullFile(speaker, fileName)
|
|||||||
file.close()
|
file.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function playSound(speakers, fileName)
|
local function playSound(placeholder,fileName)
|
||||||
|
local speakers = table.pack(peripheral.find("speaker"))
|
||||||
local tasks = {}
|
local tasks = {}
|
||||||
for _, speaker in ipairs(speakers) do
|
|
||||||
table.insert(tasks, function()
|
for i = 1, speakers.n do
|
||||||
playFullFile(speaker, fileName)
|
tasks[i] = function()
|
||||||
end)
|
playFullFile(speakers[i], fileName)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
parallel.waitForAll(table.unpack(tasks))
|
parallel.waitForAll(table.unpack(tasks, 1, speakers.n))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user