Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Ieldra

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by Ieldra

  1. All right, I solved problem (2) on my own. I was unaware of lua's feature to allow more than one variable on the left side of an assignment. That still leaves my inability to reroute a program's output to a text file using ">", or to write text files with the filesystem.open and file.write functions (see previous posts)
  2. All right. More testing. Regarding problem (1): This code.... local fs=require("filesystem") local f=io.open("/testfile.txt","w") print(f) print(io.output(f):write("testtext\r\n")) io.close(f) ...works perfectly fine. The version using filesystem.open and file.write doesn't. It produces an empty file. And rerouting the program's output with ">" likewise produces an empty file. Regarding problem (2): This code looks for ReactorCraft hydrogen preheaters and lists their coordinates: local p = {} local co = require("component") local n = 0 for k,v in co.list() do if string.fin
  3. Here's a simple test program: local fs=require("filesystem") local f=fs.open("/testfile.txt","w") print(f) print(f.write("testtext")) f.close() This produces the following output: table <some address> -- from the print(f), so there is a file handle, which means the "open" has worked, right? nil file is closed -- from the print(f.write...) - well, inexplicably there doesn't seem to be an open file anymore one line later... followed by an error message that I try to index a nil value (since f has tu
  4. Hi everyone, I'm just starting out with OpenComputers. I have no problem with the coding, but there are things that don't work where I think they should work: (1) I'm trying to write a component list to a text file, since the number of components is too large to fit on a screen. I've written this code: local co=require("component") local fs=require("filesystem") local f=fs.open("textfile.txt","w") --print(f) (commented test line) for k,v in co.list() do print(k,v) print(f.write(k.." "..v.."\n\r")) end end f.close() The file does get opened with the fs.open s
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.