(Ex:
Spoiler
list = {
["Hey"] = [[
1) bleh
2) hi
]],
["Bye"] = [[
1) hmm
2) heh
]]}
for i, v in pairs(list) do print(i) print(v) end
could turn out:Hey
1) bleh
2) hi
(2nd item)
or
Bye
1) hmm
2) heh
(1st item)
I read on the ComputerCraft wiki that:
"Note that ipairs is identical to pairs, except it tries to do it in order."
So I assumed that if I used ipairs() in my for loop instead of pairs(), it would work in order. But apparently no, as when I restart the computer after saving the changes, the program doesn't even seem to run.
Here's my code, for those who are interested.
Spoiler
local items =
{
["A place to start"] = [[
1) Iron Chest
2) Quarry
3) Computer (CC)
4) Apiarist's Machine
5) Router
6) Solar Panel
7) Macerator
8) Electric Furnace
9) Compressor]],
["Getting advanced"] = [[
1) Induction Furnace
2) Mass Fabricator
3) Reactor Chamber
4) HV-Transformer
5) MFSU
6) Medium Voltage Solar Array
7) Teleporter
8) Tesla Coil
9) MFFS Projector]],
["Bad day for the creepers"] = [[
1) TNT
2) Nuke
3) Industrial TNT
4) Fire Charge
5) Dynamite
6) Fire Basin
7) Destruction Catalyst
8) Sulfuric Acid
9) Condensed Splash Serum]],
["Things that glow lots"] = [[
1) Glowstone
2) Touchstone of Midas
3) REther Pearl
4) Corrupted Essence
5) Potions of Swiftness (Speed II 1:30)
6) Nano Saber
7) Light Turtle (No other attachments)
8) Gravity Gun (Not Supercharged)
9) Redstone Lamp]]
}
local m = peripheral.wrap("top")
term.redirect(m)
m.setTextScale(2.5)
for i, v in ipairs(items) do --The ipairs() here used to be pairs(), and is the line that seems to be erroring without output
local event = os.pullEvent("monitor_touch")
term.clear()
term.setCursorPos(1, 1)
textutils.slowWrite(i)
term.setCursorPos(1, 2)
textutils.slowWrite(v)
end