Use 'self' like 'currentRow' if currentRow is unavailable on table

Sometimes, currentRow just isn't available as a table method when you're working within components of that table.

I've also noticed that on many occasions when we're in the inspector GUI for an element on a table where we can't iterate over currentRow, we often can iterate over item and/or i. Using these along with self, we can mimic the behavior of currentRow. Here's how, and why:

self.data[i].TABLE_COLUMN_NAME

...will work the same as...

currentRow.TABLE_COLUMN_NAME

This is because where we can iterate over an array with item or i, the i iteration is the index of the current item in a row, aka the currentRow. When we iterate over self.data, it expects us to designate a specific index in the table array. And since item and i are dynamic, it enables us to iterate over a table with the same behavior as currentRow in areas where it may not be available.

Hope someone else finds this useful! :pray:

4 Likes

One time I accidentally found the use of [i] in a work project and forgot how I stumbled across it. This is neat man! Definitely need to remember this trick.

1 Like