slam
slam copied to clipboard
remove_stopped function doesn't remove stopped
Whenever I would call "sound:stop()" it would only stop one instance, even if there were many playing. This was apparently due to the remove_stopped function indiscriminately removing sound instances even if they were still playing. A simply check fixed this and now calling stop() stops all playing instances
local function remove_stopped(sources) local remove = {} for s in pairs(sources) do if(s:isStopped())then remove[s] = true end---added the check here end for s in pairs(remove) do sources[s] = nil end end