Get physics object number from physics object

I need to know if there is a function to get a physics object’s number (supposing its from a ragdoll), like if a physics object was gotten from GetPhysicsObjectNum(3), I need a way to know the returned physics object’s number.

Sorry if that is a little confusing…

[lua]
local meta = _R.PhysObj

function meta:GetPhysicsIndex()

    local ent = self:GetEntity()

    for i=0, ent:GetPhysicsObjectCount()-1 do

            if (ent:GetPhysicsObjectNum(i) == self) then

                    return i
            end
    end

end
[/lua]

I was thinking of doing that, but I thought there might be another way… Anyway, thanks!

[lua]
local meta = _R.Entity

local oldFunc = meta.GetPhysicsObjectNum

function meta:GetPhysicsObjectNum(id)

    local phys = oldFunc(self, id)

    phys._id = id

    return phys

end
[/lua]
:v:

…Ok…well…That was obvious… I should have thought of that…