Fix SoundGroup:get method
This commit is contained in:
parent
245f77f0ea
commit
c797635445
30
api.lua
30
api.lua
@ -224,20 +224,30 @@ SoundGroup = {
|
|||||||
local count = self:count()
|
local count = self:count()
|
||||||
if count == 0 then return end
|
if count == 0 then return end
|
||||||
|
|
||||||
|
local retval
|
||||||
if type(idx) == "number" then
|
if type(idx) == "number" then
|
||||||
return self[idx]
|
retval = self[idx]
|
||||||
end
|
elseif count == 1 then
|
||||||
|
retval = self[1]
|
||||||
if count == 1 then
|
else
|
||||||
return self[1]
|
retval = {}
|
||||||
end
|
|
||||||
|
|
||||||
local all_sounds = {}
|
|
||||||
for _, snd in ipairs(self) do
|
for _, snd in ipairs(self) do
|
||||||
table.insert(all_sounds, snd)
|
table.insert(retval, snd)
|
||||||
|
end
|
||||||
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,
|
end,
|
||||||
}
|
}
|
||||||
setmetatable(SoundGroup, SoundGroup.__init)
|
setmetatable(SoundGroup, SoundGroup.__init)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user