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

[Question][LUA][Error] Trying to incorperate an item in code, not working

Started by bdd458, 01 May 2012 - 12:27 AM
bdd458 #1
Posted 01 May 2012 - 02:27 AM
Hello all,
Today was my first time coding, ever. From reading around I have seen that a good rule of thumb is trying to figure something out yourself. Well, I've tried that for a while and I still can't come up with a solution. (Also, I'm using Tekkit, and because of that, I am using an outdated version MC)

Basically I'm trying to make a light system that will turn on and off when I use the computer system, eventually to when I open the door using the computer. But baby steps. So I found a tutorial to help me get started coding (http://www.minecraft...l-updated-1112/). So I got the redstone to work, but this is where I can't get things to work. As I said, I am using Tekkit, but want to use the Red Alloy Wire for this system instead of Redstone. So first I try using


redalloywire.setOutput("back", true)

I also try different combinations of


Red Alloy Wire.setOutput("back", true)
Redalloywire.setOutput("back", true)

When trying to do this I get the error of
lua>:1:Attempt to index ? (a nil value)

And when I have all three words have spaces between them I get
lua>:1:Attempt to call Nil

Obviously they are trying to draw from something that doesn't exist, but I really want to know how to do this. I'm completely clueless and all your help will be appreciated. Once I get a good footing, hopefully things will come a little easier.
libraryaddict #2
Posted 01 May 2012 - 02:37 AM
You still use rs.setOutput
MysticT #3
Posted 01 May 2012 - 03:09 AM
redstone (or rs for short) is an API, not the actual item. So to use the RP wire you still have to use that API (redstone or rs).
So, this:

rs.setOutput("side", true/false)
enables/disables the redstone output from the computer, so you can put anything that receives redstone "current" and it would receive it when enabled.
Try setting an output to true on any side, and then place redstone dust on that side, you'll see it's on. Then remove the redstone and place the RP wire, it will turn on also.
Hope this helps you understand a little bit more about CC and redstone :)/>/>
Also, you should first try and understand the language and how it works before going into CC stuff. It might make things easier to understand.
bdd458 #4
Posted 01 May 2012 - 10:18 PM
Thanks for the reply, it worked :)/>/>. I'll look into reading some more about LUA coding, but I always find it easier to jump right into these types of thing. Getting my feet wet kind of thing.