This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SuicidalSTDz's profile picture

How to get data from a Github repository

Started by SuicidalSTDz, 24 March 2013 - 09:05 AM
SuicidalSTDz #1
Posted 24 March 2013 - 10:05 AM
Solved and in wrong section! Go help someone else! ^_^/>
MysticT #2
Posted 24 March 2013 - 11:03 AM
Just make an http request (using http.get) to that url, and you'll get the contents as response.
This should work:

local response = http.get("https://raw.github.com/SuicidalSTDz/EnderOS/master/config")
if response then
  local contents = response.readAll()
  response.close()
  print(contents)
end
SuicidalSTDz #3
Posted 24 March 2013 - 11:03 AM
Just figured that out :P/>
Mine is more compact


local response = http.get("https://raw.github.com/SuicidalSTDz/EnderOS/master/config")
local sResponse = response.readAll()
response.close()
print(sResponse)
MysticT #4
Posted 24 March 2013 - 11:09 AM
Just figured that out :P/>
Mine is more compact


local response = http.get("https://raw.github.com/SuicidalSTDz/EnderOS/master/config")
local sResponse = response.readAll()
response.close()
print(sResponse)
It's actually the same code, just that I checked if there was a response. You should make that check, the request may fail and the response would be nil, making the program error.

Edit: lol, just realized this is the tutorials section :P/>
AfterLifeLochie #5
Posted 24 March 2013 - 11:34 AM
I've sailed ye topic to the correct port. Silly captains and their vessels…
SuicidalSTDz #6
Posted 24 March 2013 - 01:50 PM
I've sailed ye topic to the correct port. Silly captains and their vessels…
Creative buggart aren't ye?