Code: Select all
function love.load()
news = {}
delay = 10
width = love.graphics.getWidth()
end
function love.update(dt)
if delay > 0 then
delay = delay - dt
else
table.insert(news, 1, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin in porta nunc. Donec condimentum porttitor faucibus.")
delay = 10
end
end
function love.draw()
love.graphics.printf(table.concat(news,"\n"), 30, 20, width - 300, "left") --bad code, load cpu
---AND OTHER VARIANTS LOAD CPU TOO---
--love.graphics.print(news, 30, 20) --bad code, load cpu
--love.graphics.printf(news, 30, 20, 1000, "left") --bad code, load cpu
--love.graphics.printf(table.concat(news,"\n"), 30, 20, 1000, "left") --bad code, load cpu
--for i in pairs(news) do
-- love.graphics.print(news[i], 30, 15 * i) --bad code, load cpu
--end
--for i in pairs(news) do
-- love.graphics.print(tostring(news[i]), 30, 15 * i) --bad code, load cpu
--end
love.graphics.print(#news, 1, 220)
end