Im iterating out multiple lists in js like this:
0 0 tracks track1
0 0 tracks track2
0 0 tracks track3
However, sometimes I might have an empty element at the end of the list:
0 0 tracks
I would like to be able to detect that the last list element is empty. I cant seem to do this inside the js object, or outside in Max.
In Max, ive tried using "zl len" to detect the size of the list, but Max seems to believe that the list element is there, even though it is empty.
The same goes for inside the js object. Ive tried using
if (var == "")
Even though the part of the list is empty, there seems to be no way of recognising that it is empty.
Id be really grateful if anyone has any insights to a way of working around this.
UPDATE: Finally ive got it "if (var == 0)"
An array in js always of the length property. You can probably do something like:
if (yourvar.length < 3)
If your problem is that the last item of the list may be an empty string, you could use [sadam.empty] to detect that.
removing it or replacing it with the symbol "zzz" might be also an option.
Log in to reply
C74 IN YOUR INBOX
C74 RSS Feed | © Copyright Cycling '74 | Terms & Conditions
Let us tell you about notable Max projects, obscure facts, and creative media artists of all kinds.