- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
GrimmSpector
-
Content Count
10 -
Joined
-
Last visited
Posts posted by GrimmSpector
-
-
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.
-
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)
-
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!
-
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
go to a file of my own choosing
Seems to be a weird thing to do in lua?
-
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!
-
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.
-
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.
-
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!
-
I would love to get an answer for this as well. It's great that I can access all those connected machines ... but it's severely limiting with lower tier machines when I only want to access the machine I'm directly connected to!
Table not being recognized?
in Programming
Posted
Ah I didn't realize lua did it that way, ok thanks!