diff options
| author | Sam <github@samlord.co.uk> | 2025-02-01 17:23:24 +0000 |
|---|---|---|
| committer | Sam <github@samlord.co.uk> | 2025-02-01 17:23:24 +0000 |
| commit | e343ffee5a4663374a77073a3e4370041f2fc431 (patch) | |
| tree | 1e87af364dc3b2d31070921ff04199c932ada129 /lua/table_iterator.lua | |
| parent | b98e67972bca390961ecd2240ab3d3553ea0bf86 (diff) | |
| download | tangara-fw-e343ffee5a4663374a77073a3e4370041f2fc431.tar.gz | |
Add playlist browser
Add a menu item to main menu and associated browser for playlist files
in the root of the SD card
Diffstat (limited to 'lua/table_iterator.lua')
| -rw-r--r-- | lua/table_iterator.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lua/table_iterator.lua b/lua/table_iterator.lua new file mode 100644 index 00000000..5bacada6 --- /dev/null +++ b/lua/table_iterator.lua @@ -0,0 +1,27 @@ + +local TableIterator = {} + +function TableIterator:create(table) + local iterator = {}; + iterator.index = 0; + iterator.table = table; + + function iterator:clone() + return TableIterator:create(table) + end + + function iterator:next() + self.index = self.index + 1 + return self.table[self.index] + end + + function iterator:prev() + self.index = self.index - 1 + return self.table[self.index] + end + + return iterator +end + + +return TableIterator
\ No newline at end of file |
