p5.js | saveTable() Function
The saveTable() function is used to save a p5.Table object to a file. The format of the file saved can be defined as a parameter to the function. By default, it saves a text file with comma-separated-values, however, it can be used to save it using-tab separated-values or generate an HTML table from it.
saveTable( Table, filename, options )
Parameters: This function accept three parameters as mentioned above and described below:
- Table: This is a p5.Table object that would be saved to the file.
- filename: It specifies the string that is used as the filename of the saved file.
- options: It is a string which denotes the format of the table to be saved. It can be either “csv” which saves the table using comma-separated-values, “tsv” which saves the table using tab-separated-values, or “html” which generates an HTML table. It is an optional parameter.
Below example illustrates the saveTable() function in p5.js:
Online editor: https://editor.p5js.org/