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

Monitors and data transfer over Rednet

Started by Strategist, 28 June 2012 - 12:38 PM
Strategist #1
Posted 28 June 2012 - 02:38 PM
Hey guys, i'm new to coding with Lua, i only knew Java before this, and i was wondering how i make displays on monitors? I copied the Cobblestone Generator monitor program from the wiki tutorial page, but whenever i run the program, it's only shown on the Turtle's screen, and not the monitor. any way to change that?

Also, is there a way to send files themselves over the Rednet, or is it just to send text/info? Is it a part of the Rednet API i overlooked or is there an API out there that can accomplish it? It would be nice to send programs over that way instead of building and tearing down Disk Drives and holding a floppy with me all the time =P

Thanks for any info you can send my way,
Strategist
ardera #2
Posted 28 June 2012 - 03:59 PM
rednet is only for text, but you can code a program that can transport files
Strategist #3
Posted 28 June 2012 - 04:03 PM
Ok, any ideas how to do that? maybe make a string out of the program, send it, then have the other computer edit a program and insert that text? can we do that over range?
MysticT #4
Posted 28 June 2012 - 05:39 PM
You can read the file contents using the fs api:

local file = fs.open("PathToFile", "r")
if file then
  local s = file.readAll()
  -- send s here
  file.close()
end

To display text on a monitor in a program:

term.redirect(peripheral.wrap("<side>"))
-- program
term.restore()

But if you want to run an existing program in a monitor, you can use the monitor program. I think it's used like:
> monitor <side> <programname> <arguments>
Strategist #5
Posted 29 June 2012 - 03:20 AM
Ok, thanks. ill try to whip something up later on and see how it works