Advertisement
HangMan23

ывфвф

Aug 3rd, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local io = require("io")
  2. local serialization = require("serialization")
  3. local EU = require("ExtraUtilits")
  4. local fs = require("filesystem")
  5.  
  6. local field, w, h, path = table.unpack({...})
  7.  
  8. local file = io.open(path, "wb")
  9.  
  10. file:write(serialization.serialize({w = w, h = h}) .. "\n")
  11.  
  12. print(w * h)
  13.  
  14. sas = 1
  15.  
  16. for i = 1, w do
  17.  
  18. for j = 1, h do
  19.  
  20. if field[i][j].symbol then
  21.  
  22. local background = {EU.Color.Extract(field[i][j].background)}
  23. local foreground = {EU.Color.Extract(field[i][j].foreground)}
  24. local symbol = field[i][j].symbol
  25.  
  26. local back = string.char(background[1]) .. string.char(background[2]) .. string.char(background[3])
  27. local fore = string.char(foreground[1]) .. string.char(foreground[2]) .. string.char(foreground[3])
  28.  
  29. file:write(back .. fore .. symbol .. "\n")
  30.  
  31. else
  32.  
  33. file:write("-\n")
  34.  
  35. end
  36.  
  37. print(sas)
  38.  
  39. sas = sas + 1
  40.  
  41. end
  42.  
  43. end
  44.  
  45. file:close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement