ST Data Table
A table downloaded from the web (TSV or CSV, one row per line) that your scripts read, search and sort: a media catalogue, a leaderboard, a word list. StageTime does the work in its own code, so a table with tens of thousands of rows never enters your script and never runs into the script limits. Add it with Add Component → StageTime → ST Data Table.
In a future SDK update, ST Data Table will only load from an approved list of sources, and links to other sites will stop loading. The list will be published in these docs before the change. See the Roadmap.
| Field | |
|---|---|
url | The https link to the table file (up to 16 MB) |
delimiter | The character between cells: Tab, Comma, Semicolon or Pipe. Except with Tab, cells may be "quoted, like this" ("" for a quote); a line break always ends a row |
firstRowIsHeader | The first line holds column names (see GetColumn); it is not a row |
loadOnStart | Download when the world loads |
cacheMinutes | Reuse a downloaded copy for this many minutes, also after rejoining (default 60; 0 = always download) |
Each player's device downloads the table. If a download fails, an older cached copy is used when there is one.
Events
Scripts on the same GameObject get:
| Event | When |
|---|---|
OnDataLoaded() | The table loaded (or reloaded) |
OnDataError() | It could not load; read error |
Reading
| Member | |
|---|---|
isLoaded, isLoading, error | State |
rowCount, columnCount | Size (0 until loaded) |
GetString(row, column) | A cell's text ("" outside the table) |
GetInt(row, column), GetFloat(row, column) | A cell as a number (0 if it isn't one) |
GetColumn(name), GetHeader(column) | With firstRowIsHeader: a column by name (-1 if missing), a column's name |
Load(), LoadUrl(url) | Download again, or another table. The current table stays until the new one arrives |
Rows and columns count from 0.
Sorting and searching
SortBy(column) sorts by a column: by number when every filled cell is a number, otherwise alphabetically (any
case). SortBy(-1) goes back to file order. Rows keep their numbers; GetSortedRow(position) tells you which row is
at a position in the current order.
Search(column, text, results) finds rows whose cell in column contains text (any case; column -1 searches every
column). It writes up to results.Length row numbers, in the current sort order, and returns how many it wrote.
lastMatchCount is the total number of matches, which can be more. SearchBoth(columnA, textA, columnB, textB, results) finds rows matching both texts; an empty text matches every row.
public class CatalogueList : StageTimeBehaviour
{
public TMP_Text[] rows; // 8 labels
private STDataTable items;
private int[] results = new int[200];
private void Start() => items = GetComponent<STDataTable>();
public override void OnDataLoaded()
{
items.SortBy(1); // column 1: titles
for (int i = 0; i < rows.Length; i++)
rows[i].text = items.GetString(items.GetSortedRow(i), 1);
}
public void FindLove()
{
int count = items.Search(1, "blue", results);
for (int i = 0; i < rows.Length; i++)
rows[i].text = i < count ? items.GetString(results[i], 1) : "";
}
}
See the catalogue browser example for paging, sorting by two columns and searching.
Only https links work. Hosts may be restricted to an allowlist later.