Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updateProgram(pastebinCode, programFile, isLua)
- local response = http.get("https://pastebin.com/raw/" .. pastebinCode)
- if isLua == "lua" then
- programFile = programFile .. ".lua"
- end
- if response then
- local programCode = response.readAll()
- response.close()
- local file = fs.open(programFile, "w")
- file.write(programCode)
- file.close()
- print("Program updated successfully!")
- else
- print("Failed to update program.")
- end
- end
- -- Main program
- local args = {...}
- local isLua = args[3]
- local programToUpdate = args[1]
- local pastebinCode = args[2]
- print("Note: to update a program ending in .lua please add the extra argument 'lua' when using this program")
- print("otherwise there will be a new program NOT ending in .lua")
- print("Example: update example.lua AbCd1234 lua")
- print("Updating " .. programToUpdate .. "...")
- updateProgram(pastebinCode, programToUpdate, isLua)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement