I'm using Kadoba's code and am running into a couple of issues.
Code: Select all
functs[ #functs+1 ] =
function(key)
selectorY = 45
if key == "up" then
if selectorY > 45 then
selectorY = selectorY-50
end
end
if key == "down" then
if selectorY < 95 then
selectorY = selectorY+50
end
end
end
selectorY is a variable used in drawing a rectangle, a basic selection/highlight box. This SEEMED to work; I had two positions on the screen, I could move my box between them, and it wouldn't go "over". So I added a third position, and changed the down key code from 95 to 145. But the box won't move down to the third position; I checked with a quick output of selectorY and it won't go higher than 95, even though it should be within the parameters. Furthermore, the up key works fine, but EVERY KEY does so as well! If the box is in the second (lower) position, any other key pressed (except down) will result in the box moving up.
These things are weird and I have no idea why they are happening.
EDIT: okay after writing this I thought of some things to try. If I change the up key parameter from 45 to 15, the box now jumps between 95 and -5. Which is 100 point difference, which is 50 * 2, so I understand where that number is coming from but not WHY. So I am making some kind of basic Lua mistake on that front.
Still don't know why every key on the keyboard acts as up, though.