I'm trying to do something that should be relatively simple: turn on a bunch of redstone i/o blocks. 48 in total. I don't want to define these individually, so I thought I could use a table. I tried Molinko's answerhere and successfully inserted the ID's in a table. Now, I want to iterate through the table and setOutput for each one.
I am banging my head on a wall. I have tried many different things, but am unable to figure out how to do this without defining a variable for each one.
I have something like:
local component = require("component")
local sides = require("sides")
local rst = {}
for address in component.list('redstone') do
local r = component.proxy(address)
table.insert(rst,r)
end
for k,v in pairs(rst) do
//what do I put here to turn on output for all redstone i/o? assume side is up.
end
I have confirmed that rst has...something?...in it by printing the k/v values, but I also notice that the values don't match the IDs of the blocks. Am I even doing that part right?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hey, Some background first. Minecraft=not newbie; Programming=not newbie; OC = newbie; Lua=newbie
I'm trying to do something that should be relatively simple: turn on a bunch of redstone i/o blocks. 48 in total. I don't want to define these individually, so I thought I could use a table. I tried Molinko's answer here and successfully inserted the ID's in a table. Now, I want to iterate through the table and setOutput for each one.
I am banging my head on a wall. I have tried many different things, but am unable to figure out how to do this without defining a variable for each one.
I have something like:
I have confirmed that rst has...something?...in it by printing the k/v values, but I also notice that the values don't match the IDs of the blocks. Am I even doing that part right?
Thank you.
Link to post
Share on other sites