View difference between Paste ID: 7G6LXvxm and aZkUP7TJ
SHOW: | | - or go back to the newest paste.
1-
local arg = { ... }
1+
local _, files = os.pullEvent("file_transfer")
2-
2+
for _, file in ipairs(files.getFiles()) do
3-
if arg[2] ~= nil then
3+
  local size = file.seek("end")
4-
	local file = fs.open("songs/" .. arg[1] .. ".txt", "w")
4+
  file.seek("set", 0)
5-
5+
  local f = fs.open("songs/" .. file.getName(), "w")
6-
	file.write(arg[2])
6+
  f.write(file.readAll())
7-
7+
  f.close()
8-
	print("Sucessfully wrote song to device. Play with 'play \"" .. arg[1] .. "\"'.")
8+
  print("Sucessfully wrote song to device. Play with 'play \"" .. file.getName() .. "\"'.")
9-
9+
end