adding feature to limit table size to 10 to table example

This commit is contained in:
Daniel Shiffman
2013-03-09 14:22:20 -05:00
parent c66eba022a
commit deb9e304a1

View File

@@ -69,6 +69,12 @@ void mousePressed() {
row.setFloat("y", mouseY);
row.setFloat("diameter", random(40, 80));
row.setString("name", "Blah");
// If the table has more than 10 rows
if (table.getRowCount() > 10) {
// Delete the oldest row
table.removeRow(0);
}
// Writing the CSV back to the same file
saveTable(table,"data/data.csv");