fork download
  1. s = [[v 1.000000 0.000000 -1.000000
  2. v 1.000000 0.000000 1.000000
  3. v -1.000000 0.000000 1.000000
  4. v -1.000000 0.000000 -1.000000
  5. v -0.000000 2.000000 0.000000
  6. vn 0.0000 -1.0000 0.0000
  7. vn 0.8944 0.4472 0.0000
  8. vn -0.0000 0.4472 0.8944
  9. vn -0.8944 0.4472 -0.0000
  10. vn 0.0000 0.4472 -0.8944]]
  11.  
  12. i = 1
  13. for word in
  14. string.gmatch(s, "v [0-9.-]* [0-9.-]* [0-9.-]*") do
  15. --print(word)
  16. -- outputFile:write("Node"..i.. "= {" ..word.. "}\n")
  17. -- outputFile:write("Node"..i.. "= {" ..string.gsub(word, "(%s)", "x=", 1).. "}\n")
  18. print("Node"..i.. "= {" ..string.gsub(word, "([^%s]) ([^%s]) ([^%s])", "x=%1 y=%2 z=%3", 1).. "}")
  19. i = i + 1
  20. end
Success #stdin #stdout 0s 2832KB
stdin
Standard input is empty
stdout
Node1= {v 1.000000 0.000000 -1.000000}
Node2= {v 1.000000 0.000000 1.000000}
Node3= {v -1.000000 0.000000 1.000000}
Node4= {v -1.000000 0.000000 -1.000000}
Node5= {v -0.000000 2.000000 0.000000}