Posted 04 June 2012 - 02:58 AM
Hey guys,
I wrote a program to automatically open the frame door of my hangar, and got it working. However, after implementing some code for a nice GUI (based on a program by NitrogenFingers), I receive a nil error upon trying to move the selection by pressing the "down" arrow:
startup:102: attempt to index ? (a nil value)
(hopefully) relevant part of code:
Entire code in the attachment.
I have no idea what is wrong, or how to fix it, so any help would be appreciated!
Thank you, in advance, for your time!
Aerik out.
I wrote a program to automatically open the frame door of my hangar, and got it working. However, after implementing some code for a nice GUI (based on a program by NitrogenFingers), I receive a nil error upon trying to move the selection by pressing the "down" arrow:
startup:102: attempt to index ? (a nil value)
(hopefully) relevant part of code:
local menustate = "main"
local mopt = {
["main"] = {
options = {"open", "close", "quit"},
draw = drawMain
}
}
function runMenu()
while true do
term.clear()
drawHeader()
mopt[menustate].draw()
local id, key = os.pullEvent("key")
if key == 200 and select > 1 then select = select-1
elseif key == 208 and select < #mopt[menustate].options then select = select+1
elseif key == 28 then
if mopt[menustate].options[select] == "quit" then break
end
if mopt[menustate].options[select] == "open" then
openSeq()
end
if mopt[menustate].options[select] == "close" then
closeSeq()
end
end
menustate = mopt[menustate].options[select]
end
end
Entire code in the attachment.
I have no idea what is wrong, or how to fix it, so any help would be appreciated!
Thank you, in advance, for your time!
Aerik out.