love.timer.getFPS() is sometimes returning a table and sometimes a number
Posted: Fri Jul 06, 2018 8:55 am
Today i am making my own timer system in Love2d, but in one function to change the delay of the timer, when i use the love.timer.getFPS() it returns me a table and when i use it on a love.graphics.print() it returns me a number. This is actually what i am doing:
I am using Löve2d 0.11.0.
This is the simplified code, the .love is attached to the post.
Code: Select all
--Timer returning function
function Timer(frames)
return {
frames = frames,
update = function(fr)
frames = fr
end
}
local t = Timer(60)
function love.update(dt)
t:update(love.timer.getFPS()) -- This love.timer.getFPS returns me a table
end
function love.draw()
love.graphics.print(love.timer.getFPS(), 0, 20) -- This returns me a number
end
This is the simplified code, the .love is attached to the post.