Jump to content




How to get data from a Github repository



  • You cannot reply to this topic
5 replies to this topic

#1 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 24 March 2013 - 10:05 AM

Solved and in wrong section! Go help someone else! ^_^

#2 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

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


#3 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

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)


#4 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 24 March 2013 - 11:09 AM

View PostSuicidalSTDz, on 24 March 2013 - 11:03 AM, said:

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

#5 AfterLifeLochie

    Wiki Oracle

  • Moderators
  • 480 posts
  • LocationAfterLifeLochie's "Dungeon", Australia

Posted 24 March 2013 - 11:34 AM

I've sailed ye topic to the correct port. Silly captains and their vessels...

#6 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 24 March 2013 - 01:50 PM

View PostAfterLifeLochie, on 24 March 2013 - 11:34 AM, said:

I've sailed ye topic to the correct port. Silly captains and their vessels...
Creative buggart aren't ye?





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users