Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / How to return the size of a LUA array?

Author
Message
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 25th May 2007 16:34 Edited at: 25th May 2007 17:20
Is there any way, or command, to return the size of the LUA array?

At the moment I can hard code it into the array file but it seems a bit clumsy if you add something to the bottom of an 2000 item array to have to scroll back to the beginning and change change the arraySize value to 2000.

I tried letting the program return arraySize + 1 to see if LUA returned a zero value I could use but it just bombs the DBP program out without an error.

dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 31st May 2007 14:57
LUA uses tables so there is no fixed index size, your best bet would be to store your index size if you're using an integer range or just do a loop through the table till you hit a nil value.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Jun 2007 11:39 Edited at: 5th Jun 2007 11:39
It's a method of table (which is what an array is)...

table.getn(MyTable)

Login to post a reply

Server time is: 2024-11-22 21:46:50
Your offset time is: 2024-11-22 21:46:50