fork download
  1.  
  2. local empty = {
  3. [0] = nil,
  4. [1] = nil,
  5. [3] = nil
  6. }
  7.  
  8. local driver = {
  9. [0] = "I'm the driver",
  10. [1] = nil,
  11. [3] = nil
  12. }
  13.  
  14. local passenger = {
  15. [0] = nil,
  16. [1] = nil,
  17. [3] = "I'm a passenger"
  18. }
  19.  
  20. print( next(empty) )
  21. print( next(driver) )
  22. print( next(passenger) )
Success #stdin #stdout 0.02s 2496KB
stdin
Standard input is empty
stdout
nil
0	I'm the driver
3	I'm a passenger