Example for entity.add doesn't remotely work

The example in the web docs for entity.add doesn’t work at all well. The main issue seems to be in the line that computes the entity eulerAngles, but I’ve not yet hammered it enough to really see what’s going on. If you twiddle things just right you can see something streaking by every 180 degrees around (which happens really fast).

I’m bashing this to try to make it work, though I am tempted to start a new version, stealing the main idea. If someone has a working one, I’d love to see it.

Here’s what’s in the document now:

-- Lua classes can be attached to entities to customise behaviour
Mover = class()

function Mover:init(entity, speed)
    self.entity = entity
    self.speed = speed

function Mover:update()
    -- Move the entity to the right at speed meters per second
    self.entity.x = self.entity.x + self.speed * DeltaTime
    self.entity.eulerAngles = vec3(0, ElapsedTime * 90, 270)

function setup()
  -- Create a new craft scene
  scene = craft.scene()

    -- Create an entity and attach a Mover to make it move automatically
    local entity = scene:entity()

    entity.model = craft.model("SpaceKit:spaceCraft6")
    entity.scale = vec3(0.1, 0.1, 0.1)
    entity.x = -10

    entity:add(Mover, 1.5)

    scene.camera.z = 20
    scene.camera.eulerAngles = vec3(0,0,180)

function update(dt)

function draw()

@RonJeffries Make these changes to the above code.

    entity.x = 0

    scene.camera.z = -30

well done! also confirms that deltaTime is not passed to object updates.