So, I'm attempting to assign unique variables for a multi-component counting program to try to make a simple monitoring program through Adapted blocks and Industrial Craft Classic energy storage blocks. (BatBox, MFE, and MFSU) At first I thought maybe I could concatenate the variable and an index number to do a simple unique variable per address called, like mfsu1, mfsu2, mfsu3, etc. But, that didn't quite work, and resulted in an error. I'm a bit stumped as to what to do about it. I searched for it as best as I could describe it, and couldn't find an answer on it. I'm sure there's some way to do it, but I'm not quite sure what it would be called, or if I'm even going about it the right way. But anyway, could someone provide me with a solution or a workaround? I'm in the Tekkify: Refored pack if that makes any difference, and it's running OC 1.5 as far as I know.
Here's my code as is (with bad code included)
cm = require("component")
local i = 1
local cnm = "mfsu"
for a,m in cm.list(cnm) do
m .. tostring(i) = a
print(m .. tostring(i))
i = i + 1
end
I apologize if I seem a bit dumb trying that, but I was a bit lost on how to proceed. Any and all help would be appreciated!
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.
So, I'm attempting to assign unique variables for a multi-component counting program to try to make a simple monitoring program through Adapted blocks and Industrial Craft Classic energy storage blocks. (BatBox, MFE, and MFSU) At first I thought maybe I could concatenate the variable and an index number to do a simple unique variable per address called, like mfsu1, mfsu2, mfsu3, etc. But, that didn't quite work, and resulted in an error. I'm a bit stumped as to what to do about it. I searched for it as best as I could describe it, and couldn't find an answer on it. I'm sure there's some way to do it, but I'm not quite sure what it would be called, or if I'm even going about it the right way. But anyway, could someone provide me with a solution or a workaround? I'm in the Tekkify: Refored pack if that makes any difference, and it's running OC 1.5 as far as I know.
Here's my code as is (with bad code included)
I apologize if I seem a bit dumb trying that, but I was a bit lost on how to proceed. Any and all help would be appreciated!
Link to post
Share on other sites