Fix SoundGroup:get method

This commit is contained in:
Jordan Irwin 2021-08-09 14:07:20 -07:00
parent 245f77f0ea
commit c797635445

30
api.lua
View File

@ -224,20 +224,30 @@ SoundGroup = {
local count = self:count()
if count == 0 then return end
local retval
if type(idx) == "number" then
return self[idx]
end
if count == 1 then
return self[1]
end
local all_sounds = {}
retval = self[idx]
elseif count == 1 then
retval = self[1]
else
retval = {}
for _, snd in ipairs(self) do
table.insert(all_sounds, snd)
table.insert(retval, snd)
end
end
return all_sounds
if self.no_prepend ~= true then
local rtype = type(retval)
if rtype == "string" then
retval = "sounds_" .. retval
elseif rtype == "table" then
for idx, snd in ipairs(retval) do
retval[idx] = "sounds_" .. snd
end
end
end
return retval
end,
}
setmetatable(SoundGroup, SoundGroup.__init)