|
| 12 Jul 2014 09:29 PM |
For example, how would I get the length of the following array? local a = {["Cat"] = 1,["Pat"] = 3} print(#a) > 0 |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2014 09:30 PM |
I don't want to do..
local count = 0 local a = {["Cat"] = 1,["Pat"] = 3} for _, v in pairs(a) do count = count+1 end print(count) >2
It's too long |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2014 09:32 PM |
To get the length of an array do:
print(#a)
or
print(#ArrayName) |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2014 09:34 PM |
bro
you did not read my post... when the index is not a number, it isn't counted with # |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Jul 2014 09:42 PM |
| Oh, sorry. I read the post just not the code. My bad. :/ |
|
|
| Report Abuse |
|
|
| |
|