Update db.lua

Better db format. Retains order.