Jump to content




How to read a .txt from a link (http://example.com)


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

#1 MrDiabli

  • New Members
  • 1 posts

Posted 15 May 2016 - 10:37 PM

Hello,

I am a very novice with computercraft and I'd like to display a .txt from an external link on a monitor but I don't know what to use.

What's more, I'd like to know why doesn't this code work?
local monitor = peripheral.wrap("right")
local txt = "Hello"

monitor.SetCursorPos(1,1)
monitor.write(txt)

Thank you

#2 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 15 May 2016 - 11:19 PM

it's setCursorPos not SetCursorPos

Edit: Also, try HTTP api

Edited by Dragon53535, 15 May 2016 - 11:20 PM.


#3 Nothy

  • Members
  • 249 posts
  • LocationMars

Posted 16 May 2016 - 10:07 AM

If you want to read a file on a website, you can do this:

local url = "http://www.nothy.se/files/test.txt"
local data = http.get(url)
print(data.readAll()) --#If you want to run the file, simply write the data to a file and run it!






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users