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

GrimmSpector

Members
  • Content Count

    10
  • Joined

  • Last visited

Posts posted by GrimmSpector

  1. I've got a piece of code, trying to insert some values into a table, as below.

    
    local table1, table2, table3 = {}
    
    function somefunction(inputtable)
      for k,v in pairs(inputtable) do
        if k == "1" then
          table.insert(table1, v)
        elseif k == "2" then
          table.insert(table2, v)
        end
      end
    end
    

    I get an error referencing one of the table insert lines, like this:

    extractorController.lua:34: bad argument #1 to 'insert' (table expected, got nil)
    stack traceback:
        [C]: in function 'insert'
        extractorController.lua:34: in function 'somefunction'
        [C]: in function 'xpcall'
        machine:751: in function 'xpcall'
        /lib/process.lua:78: in function </lib/process.lua:71>
    stack traceback:
        [C]: in function 'error'
        /lib/process.lua:92: in function </lib/process.lua:71>
    

    Clearly I'm defining these tables at the start of the file...so I'm not sure why this is occurring...? I'd really appreciate some help figuring this out! Thanks.

     

     

  2. Simple function injection

    function io.stderr:write(str)
    	logFile = filesystem.open(self.path, "a")
    	logFile:write(str.."\n")
    	logFile:close()
    	return self
    end
    

    Either replace self.path with a path or leave it as is and change io.stderr.path to change the path of the next error log writes.

     

    Well...this crashes the OC hard...

    "Unrecoverable Error"

    controller.lua:50: attempt to index global 'logFile' (a nil value) 
    
  3. Simple function injection

    function io.stderr:write(str)
    	logFile = filesystem.open(self.path, "a")
    	logFile:write(str.."\n")
    	logFile:close()
    	return self
    end
    

    Either replace self.path with a path or leave it as is and change io.stderr.path to change the path of the next error log writes.

     

    Perfect, thanks!

  4. You probably just want to use

    io.stderr:write() 

     for that

     

    Not quite what I'm asking. I'm well aware of the io stream and method. However that logs when running a program to a temporary file, that I don't get to keep handy, and to the console.

     

    I don't want it to print to the GPU at all. I ONLY want it to go to a file, and I don't want it to go to a temporary file, I want to ecapsulate extra logging information and all error debug information out to a file of my choosing. Ideally with a bit of parsing to make it more readable. I can't figure out how to adjust the stream to

    a) not go to the GPU

    B) go to a file of my own choosing

     

    Seems to be a weird thing to do in lua?

  5. In a way he's trying to make it easier for people to connect to all the things in one of their sets of items, which makes a lot of sense.

     

    The real issue is there needs to be a way to code into a bios which components to select during boot, and then you're still bound by the component limit, but you can choose to ignore the ones you don't want so you can actually run...that would be super!

  6. I'd like to do error/function logging, and I'd like to do it via binding the STDERR output to a filestream instead of the GPU. I'm not familiar enough with lua yet to do it. Can anyone help me with this? Thanks.

  7. Trying to setup a system to monitor and run some Rotary Craft items, but too many items in the RotaryCraft construction count as components, and they're all seen if connected by and Rotary Craft parts, whether I want them or not. I don't care about and don't want the computer to see most of these items. However I can't boot it, because there are too many, is there some way to get it to ignore some items and boot, only binding the components I want? Thanks.

  8. So...I'm trying simple things in the interpreter to teach myself, and I'm having mostly success. However one of the machines I want to work with is the RotaryCraft Extractor...

     

    On my OpenComputers system it's listed with an address and the name "Extractor", along with all the rotarycraft machines attached to it.

     

    I can address those machines like this:

    =component.JetEngine.address
    =component.JetEngine.getName()
    

    And it will output it's address and name, the name is "Gas Turbine" in this case, and the address is the same as if I hit the block with the analyzer or as in the list of components when I use:

    local component = require("component")
    for k,v in component.list() do print(k, v) end
    

    In this list I get the Extractor as well, with an address an "Extractor" as the name. but if I try:

    =component.Extractor.address
    =component.Extractor.getName()
    =component.invoke(extractoraddress, "getName")
    

    They all return this error:

    buildcraft/api/transport/IPipeTile$PipeType
    stack traceback:
             machine:756: in function <machine:751>
             [C]: in function 'error'
             machine:631: in function 'spcall'
             machine:1270: in function 'proxy'
             boot/04_component.lua:96: in function 'setPrimary'
             boot/04_component.lua:52: in function 'isAvailable'
             boot/04_component.lua:69: in function <boot/04_component.lua:67>
             (...tail calls...)
             stdin:1: in main chunk
             [C]: in function 'xpcall'
             machine:751: in function 'xpcall'
             /bin/lua.lua:146: in main chunk
             [C]: in function 'xpcall'
             machine:751: in function 'xpcall'
             /lib/process.lua:78: in function </lib/process.lua:71>
    
    
    

    All other components that I've tried either from OC itself or from RotaryCraft seem to work fine except this one. I've tried breaking and replacing, double checked addresses with the analyzer, placed new Extractors with different addresses. And always the same error.

     

    I'd really appreciate some help in resolving this!! Thanks!

×
×
  • Create New...

Important Information

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