How to get array count?

Post topics about HALion scripting.
Post Reply
User avatar
MarcoScherer
New Member
Posts: 21
Joined: Fri Apr 14, 2017 7:19 pm
Contact:

How to get array count?

Post by MarcoScherer » Mon May 22, 2017 12:49 pm

In the official LUA docs I find the function table.getn(array) to receive the number of entries. But this doesn't work in Halion. How can I find the number count for an array?
electronic music & sound design // www.marcoscherer.de

AposMus
Junior Member
Posts: 179
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: How to get array count?

Post by AposMus » Mon May 22, 2017 8:15 pm

Easiest way is to add a # in front of the table name. # returns the length of a variable, in a table that will be the entries.

testArray = {"a", "b", "c", "d", 1, 2, 3, 4}
print(#testArray)

will print 8
Cubase Pro 8.5.2
Halion 6
HSO
Padshop Pro
Dark Planet
Windows 7 64bit, AMD Phenom IIx6 1055t, 8GB Ram, Gigabyte GA-880G-UD3H F2, Nvidia GeForce GTS450
https://dewetvanderspuy.co.za/

User avatar
MarcoScherer
New Member
Posts: 21
Joined: Fri Apr 14, 2017 7:19 pm
Contact:

Re: How to get array count?

Post by MarcoScherer » Mon May 22, 2017 9:16 pm

Awesome! Thanks!
electronic music & sound design // www.marcoscherer.de

Post Reply

Return to “Halion Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest