Prev Previous Post   Next Post Next
Old 10-13-2016, 07:32 AM   #1
Human being with feelings
DarkStar's Avatar
Join Date: May 2006
Location: Surrey, UK
Posts: 18,451
Default Q: lua: Accessing partially-populated tables?

Next question.

Let's say that I have a table in lua with these entries:
xx[11], xx[12], xx.[13],
xx[21], xx[22], xx[23], xx[24],
xx[51], xx[52], 
xx[81], xx[82], xx[83], xx[84], xx[85]
You could think of the first digit in the index as the track number and the second as the clip number (assuming <10 clips per track).

What is the best way to access each of the clips for a particular track?

Perhaps start with the track number *10 +1 (e.g 51), then use 'ipairs' which will stop at the first nil value? (With a check that I do not stray into the entries for the next track.)

Or is there a better way?
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 10:39 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.