Vector method problems

Some vector methods appear to either not function properly or simply aren’t implemented in the modern runtime. Or maybe I’m doing something wrong.

:len()
:dist() ← works if you use :distance()
:normalize()
:limit()

For example

local dist = object.position:dist(object2.position)

local steer = vec2(1,3)
local m = steer:len()

Assuming object, object2 and steer both exist and are valid vec2 objects, both return errors about expecting a number and receiving a string.

Am I doing something wrong or is the framework goofing up on me.

To elaborate further:

function Boid:align()
    local perceptionRadius = self.range
    local steering = vec2(0, 0)
    local total = 0
    
    local group = Boid["flock" .. self.group] 
    
    for _, other in ipairs(group) do
        local distance = self.position:dist(other.position)
        if other ~= self and distance < perceptionRadius then
            steering = steering + other.velocity
            total = total + 1
        end
    end
    
    if total > 0 then
        steering = steering / total
        steering = steering:normalize() * self.velocity:len()
        steering = steering - self.velocity
        steering = steering:limit(0.1)
        self:applyForce(steering)
    end
end

Based on the docs I used all these methods properly but each line containing a vec method throws errors, I’m at my wits end.

function setup()
  v1 = vec2(0,0)
  v2 = vec2(1,1)
  
  v3 = v1:dist(v2)
end

function draw()
  print(v3)
end

This throws an error about receiving a string when a number was expected

However this:

function setup()
  v1 = vec2(0,0)
  v2 = vec2(1,1)
  
  v3 = v1:distance(v2)
end

function draw()
  print(v3)
end

Prints the distance properly even though the docs say nothing about using :distance() it’s referred to as :dist()