-- ================================================================================
-- RACER PUBLIC FUNCTIONS
-- ================================================================================

function Racer.new()
	local newRacer = {}
	setmetatable(newRacer, Racer)
	
	newRacer.CurrentLap = 1
	newRacer.Laps = {}
	newRacer.FinishedRace = false
	
	return newRacer
end -- Racer.new()

function Racer:StartLap(lapNumber)
	self.Laps[lapNumber] = Lap.new()
end -- Racer:StartLap()

function Racer:FinishLap(lapNumber)
	local lap = self.Laps[lapNumber]
	lap.LapTime = tick() - lap.StartTime
	lap.Finished = true
	return lap.LapTime
end -- Racer:FinishLap()

function Racer:HasStartedLap(lapNumber)
	if lapNumber <= #self.Laps then
		return self.Laps[lapNumber].Started
	end 
	return false
end -- Race:HasStartedLap()

function Racer:HasFinishedLap(lapNumber)
	if lapNumber <= #self.Laps then
		return self.Laps[lapNumber].Finished
	end
	return false
end -- Racer:HasFinishedLap()