local util = require 'util' local texts = {} local function add(text,x,y) print('(texts): '..text) table.insert(texts,{ x=x,y=y,life=3,text=text }) end local function draw() for i=#texts,1,-1 do local t = texts[i] util.write_at(t.text,t.x,t.y) end end local SPEED = 0.1 local function update(dt) for i=#texts,1,-1 do local t = texts[i] t.y = t.y - SPEED * dt t.life = t.life - dt if t.life < 0 then table.remove(texts, i) end end end return { add=add, update=update, draw=draw, }