Frame rate

Frame rate (expressed in frames per second or FPS) is the frequency at which consecutive images called frames appear on a display.

Calculation
The frame rate can be very accurately calculated by dividing one by the DeltaTime variable. function draw FPS = 1 / DeltaTime end However, the way above does not take the average frame rate. The average frame rate can be calculated, by temporarily storing 10 frame rates in order and calculating their average. __fps = {} function setup for k = 1, 10 do        fps[k] = 1/60 end end function draw table.remove(fps, 1) fps[10] = DeltaTime local FPS = 0 for _, v in ipairs(__fps) do        FPS = FPS + v     end FPS = 10/FPS end The average frame rate takes around 60. The performance can be always improved by simplifying the code.