Finite states within classes

Hi All. Have been scratching my head over this one. The below code works fine, with the correct function being called dependant on the value of status

-- Tester
function setup()
    status=up
end

function draw()
    status ()
end

function up()
    print "up"
    status=down
end

function down ()
    print "down"
    status=up
end

However when I try and have a similar set up within a Class, I get an error and Test:self.status() is not acceptable. What is the correct syntax or am I missing something.

-- Tester
function setup()
    test=Test()
end

function draw()
    test:draw()
end


function Test:init()
    self.status=up
end

function Test:draw()   
    Test:self.status()
end

function Test:up()
    print "up"
    self.status=down
end

function Test:down()
    print "down"
    self.status=up
end

Thanks for any help.


function setup()
    test=Test()
end

function draw()
    test:draw()
end

Test=class()

function Test:init()
    self.status=self.up
end

function Test:draw()
    self:status()
end

function Test:up()    
    print ("up")
    self.status=self.down
end

function Test:down()
    print ("down")
    self.status=self.up
end

@dave1707 - thanks for your help. I thought I had tried every combination - but obviously missed the correct one. Have to be honest that calling functions from within classes always confuses me a bit - but you’ve made this very clear