n = 100 function strategy(text) local lines = toLines(text) print("Lines found: " ..tostring(#lines)) if #lines > n then local i1 = math.random(1, #lines-n) local i2 = i1+n print(table.concat(lines, "\n", i1, i2)) end end function toLines(str) local t = {} local function helper(line) table.insert(t, line) return "" end helper((str:gsub("(.-)\r?\n", helper))) return t end