Can't overwrite SWEP functions

I’m trying to forward calls to gmod_tool:GetViewModelPosition() to the stool object, like this:



    local gmod_tool = weapons.GetStored("gmod_tool")
    local old_getviewmodelposition = gmod_tool.GetViewModelPosition
    function gmod_tool:GetViewModelPosition(...)
        local t = self:GetToolObject()
        if t and t.GetViewModelPosition then
            return t:GetViewModelPosition(...)
        else
            return old_getviewmodelposition(self, ...)
        end
    end


This doesn’t work. The function is never called. No changes in that gmod_tool table get reflected in actual toolgun instances. getmetatable(a_toolgun_instance) returns the Weapon metatable.

So my question is, how would I make this work?

Apparently I have to call



weapons.Register(gmod_tool, "gmod_tool")


to reregister it and update existing entities with the function (they don’t just get the functions from their class tables?)