Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions lua/entities/gmod_wire_expression2/core/bone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ end)
-- faster access to some math library functions
local abs = math.abs
local atan2 = math.atan2
local sqrt = math.sqrt
local asin = math.asin
local Clamp = math.Clamp

Expand Down Expand Up @@ -47,15 +46,19 @@ local function GetBones(entity)
end
E2Lib.GetBones = GetBones

-- checks whether the bone is valid. if yes, returns the bone's entity; otherwise, returns nil.
local function isValidBone(b)
if type(b) ~= "PhysObj" or not IsValid(b) then return nil, 0 end
local ent = b:GetEntity()
-- checks whether the bone is valid. if yes, returns the bone's entity and bone's index; otherwise, returns nil and 0.
local function isValidBone(bone)
if type(bone) ~= "PhysObj" or not bone:IsValid() then return nil, 0 end

local ent = bone:GetEntity()

if not ent:IsValid() then
return nil
return nil, 0
end
return ent

return ent, bone:GetIndex()
end

E2Lib.isValidBone = isValidBone

--[[************************************************************************]]--
Expand Down
Loading