我目前正在为我的TI-Nspire CX创建一个小型化学应用程序(支持Lua脚本,但非常有限和限制),并且遇到了一个令人生畏的问题。我正在尝试更新cursor.execute("INSERT INTO info ([height], [weight], [type]) VALUES (%s,%s,%s)", (height, manufacturerid, weight))
,依赖drawState.currentIndex
,但#drawState
,尽管其中有3个表格。
这是我的代码,
#drawState == 0
但是,即使在启动时,该块也不会执行。进一步检查后,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
始终会导致print(#drawState)
被打印到控制台,无论它包含多少元素。有什么帮助吗?