Posted 22 July 2014 - 04:16 PM
I need help with this code:
function menu(...)
arg = {...}
x = 1
while true do
if arg[x] == nil then
break
end
x = x + 1
end
y = 2
print("["..arg[1].."]")
while true do
if y > x then
break
end
print(arg[y])
y = y + 1
end
mPos = 1
while true do
event, key = os.pullEvent("key")
if key == 200 then
if mPos < x then
mPos = mPos + 1
else
mPos = 1
end
end
if key == 208 then
if mPos > 1 then
mPos = mPos - 1
else
mPos = x
end
end
if key == 28 then
break
end
y = 1
while true do
if y > x then
break
end
if mPos == y then
print("["..arg[y].."]")
else
print(arg[y])
end
y = y + 1
end
end
end
Edited by