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