local function next_number (last, current) current = current + 1 if current > last then return nil end return current end local function range (first, last) if first > last then error "start of range must be less or equal to last value" end return next_number, last, first - 1 end local generate = { next_number = next_number, range = range, } function generate.trange (first, last) local x = {} for i in range(first, last) do table.insert(x, i) end return x end return generate