Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 committed Sep 15, 2024
1 parent b63a112 commit 2dac1d8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lua/starfall/sflib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1456,19 +1456,18 @@ function SF.CheckSound(path)
path = SF.NormalizePath(string.gsub(path, "[\"?']", ""))

-- Extract sound flags. Only allowed flags are '<', '>', '^', ')'
local flags
flags, path = string.match(path, "^([^%w_/%.]*)(.*)")
local flags, checkpath = string.match(path, "^([^%w_/%.]*)(.*)")
if #flags==0 then
flags = nil
elseif #flags>2 or string.match(flags, "[^<>%^%)]") then
SF.Throw("Invalid sound flags! "..flags, 3)
end

if not (istable(sound.GetProperties(path)) or file.Exists("sound/" .. path, "GAME")) then
SF.Throw("Invalid sound path! "..path, 3)
if not (istable(sound.GetProperties(checkpath)) or file.Exists("sound/" .. checkpath, "GAME")) then
SF.Throw("Invalid sound path! "..checkpath, 3)
end

return flags and (flags..path) or path
return path
end

function SF.CheckRagdoll(model)
Expand Down

0 comments on commit 2dac1d8

Please sign in to comment.