iteration
This commit is contained in:
		@ -1,6 +1,7 @@
 | 
				
			|||||||
local args = { ... }
 | 
					local args = { ... }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local target_branch = "main"
 | 
					local target_branch = "main"
 | 
				
			||||||
 | 
					local bin_path = "/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local program_name = args[1]
 | 
					local program_name = args[1]
 | 
				
			||||||
if program_name == nil then
 | 
					if program_name == nil then
 | 
				
			||||||
@ -14,11 +15,15 @@ io.write("Updating " .. program_name .. ".lua\n")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if response.getResponseCode() == 200 then
 | 
					if response.getResponseCode() == 200 then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    file = fs.open(program_name .. ".lua", "w")
 | 
					    file = fs.open(bin_path .. program_name .. ".lua", "w")
 | 
				
			||||||
    file.write(response.readAll())
 | 
					    file.write(response.readAll())
 | 
				
			||||||
    file.close()
 | 
					    file.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fs.move(program_name .. ".lua", "/rom/programs/" .. program_name .. ".lua")
 | 
					    -- check if program is in path
 | 
				
			||||||
 | 
					    if not shell.resolveProgram(program_name) then
 | 
				
			||||||
 | 
					        print("Program not in path, adding to path")
 | 
				
			||||||
 | 
					        shell.setPath(shell.path() .. ":" .. bin_path)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print("Updated " .. program_name .. ".lua")
 | 
					    print("Updated " .. program_name .. ".lua")
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user