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

ethanwdp

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by ethanwdp

  1. I've been writing up a bios for my drone with one major snag: text output will be a nightmare. I can't think of a "clean" way to implement a way of searching for a new line, since every space on the monitor technically has the observed text value of "" (when I added an if function to see if gpu.get returned "", it pulled through and outputted gpu.set(1,2). the previously non-occupied line had a value of "" rather than nil. also, type() is saying the type of the unoccupied space was a string).

     

    First I took a peek at the term API, since I couldn't figure out where print was defined in openOS.

     

    function term.write(value,wrap)
      local stdout = io.output()
      local stream = stdout and stdout.stream
      local previous_wrap = stream.wrap
      stream.wrap = wrap == nil and true or wrap
      stdout:write(value)
      stdout:flush()
      stream.wrap = previous_wrap
    end

     

    Surprise surprise, it relies on the IO library, which is a part of the filesystem library.  Naturally, I took a look at the IO library's output function.

    function io.input(file)
      return io.stream(0, file, 'r')
    end
    
    function io.output(file)
      return io.stream(1, file,'w')
    end
    
    function io.error(file)
      return io.stream(2, file,'w')
    end

    It simply returns io.stream, so that's where I look next.

     

    function io.stream(fd,file,mode)
      checkArg(1,fd,'number')
      assert(fd>=0,'fd must be >= 0. 0 is input, 1 is stdout, 2 is stderr')
      if file then
        if type(file) == "string" then
          local result, reason = io.open(file, mode)
          if not result then
            error(reason, 2)
          end
          file = result
        elseif not io.type(file) then
          error("bad argument #1 (string or file expected, got " .. type(file) .. ")", 2)
        end
        require("process").info().data.io[fd] = file
      end
      return require("process").info().data.io[fd]
    end

    This is what confuses me.  io.output is passing file. Not a string, not a file path, not anything. Just file. What is this 'file' and what does it have to do with text output? Why are so many basic lua functionalities missing without openOS?

  2. When I hold down ctrl and right click on a disk drive, nothing happens.

     

    I'm having a server connect to redstone I/O blocks and disk drives. If a "key" (a floppy disk) is inserted, and if it has the correct access level, it will open the door.

     

    Obviously, I'll simply need to assign a disk drive to each door. The problem I've run into is that, if I insert the key into some other disk drive on the network, it'll still open the door. If I want to have multiple doors, I'll need to fix this problem.


    And so came along 1.6 beta, which introduced a disk_drive component. Problem is that the analyzer still doesn't give me the component address.


    There is no functionality to copy a line of text FROM a computer, meaning that if I use components.lua to find the address, I'll have to manually note down the 30-something-char address. Even if using components.lua, albeit slow and inefficient, would solve the issue, it'd quickly become a problem again when I'm manually noting down and assigning the address of 20 different disk drives connected to different doors around the facility.

     

    Let's say that the godking Sangar ascends from his throne and sends a golden ray of patch-goodness to allow the analyzer to copy the address of the disk drive. Now, the problem is knowing what to do with it, which brings me to the second problem I'll have.

     

    The disk drive component has no documentation. Nada. None. I'm rather decent with Lua, and using the component would be a breeze - but only if I knew what it allows me to call.

     

    I'm not sure where to go from here. I am well aware that I have downloaded an open beta, an unfinished program released solely for testing, and I am well aware of the pros and cons, so please do not mistake what I am saying as impatience or ignorance. Is there another way to accomplish my goal, or will I have to wait?

×
×
  • Create New...

Important Information

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