fork(1) 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))
  15.  
  16. --https://pt.stackoverflow.com/q/33301/101
Success #stdin #stdout 0s 14120KB
stdin
Standard input is empty
stdout
2