fork download
  1. function table.map_length(t)
  2. local c = 0
  3. for k,v in pairs(t) do
  4. c = c+1
  5. end
  6. return c
  7. end
  8.  
  9. A = {
  10. ["b"] = {c=1, d=2},
  11. ["e"] = {f=1, g=2},
  12. }
  13.  
  14. print(table.map_length(A))
Success #stdin #stdout 0.02s 2544KB
stdin
Standard input is empty
stdout
2