fork download
  1. -- table x,y,z
  2. function w(x,y,z)
  3. c="black"
  4. if z<0 then c="red" end
  5. return c
  6. end
  7.  
  8. n=1
  9. y=0
  10. for x = -n, n do
  11. for z = -n, n do
  12. --print(x,y,z)
  13. c=w(x,y,z)
  14. print( string.format("%3d %2d %2d %s", x,y,z, c) )
  15. end
  16. end
  17.  
Success #stdin #stdout 0s 14120KB
stdin
Standard input is empty
stdout
 -1  0 -1 red
 -1  0  0 black
 -1  0  1 black
  0  0 -1 red
  0  0  0 black
  0  0  1 black
  1  0 -1 red
  1  0  0 black
  1  0  1 black