I'm currently creating a small chemistry application for my TI-Nspire CX (supports Lua scripting, though, very limited and restrictive), and have run into a daunting issue. I'm attempting to update drawState.currentIndex
, relying on #drawState
, but #drawState == 0
despite it having 3 tables within it.
Here's my code,
local drawState = {
currentIndex = 2,
table = { draw = true,
focus = 'none',
drawFocused = false,
},
menu = { draw = false, }
}
...
-- Called whenever enter key is pressed on calculator
function on.enterKey()
if (drawState.currentIndex < #drawState) then
drawState[drawState.currentIndex].draw = false
drawState[drawState.currentIndex + 1].draw = true
drawState.currentIndex = drawState.currentIndex + 1
end
end
However, the block never executes, even at start-up. Upon further inspection, print(#drawState)
always results in 0
being printed to console, regardless of how many elements it contains. Any help?