Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Array Size Callbacks & Function
#1
Bug 
Code:
tablename = {1,5,12,3,"test"}

The output will be 5

Code:
table.getn(tablename)
Example Usage:
Code:
print(table.getn(tablename))

or
Code:
#tablename
Example Usage:
Code:
print(#tablename)

or
Code:
function tablelength(tablename)
  count = 0
  for _ in pairs(tablename) do count = count + 1 end
  return count
end
Example Usage:

Code:
function tablelength(tablename)
 count = 0
 for _ in pairs(tablename) do count = count + 1 end
 return count
end

function test()
tablelength(tablename)
print(count)
end test()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Self Repeating Function BcY 0 151 22-08-2019, 04:56 PM
Last Post: BcY

Forum Jump:


Users browsing this thread: 1 Guest(s)
Flag Counter