It seems that fe.get_input_state works fine with letter keys, like "A", "B" ecc, but has some issues with numbers like "1", "2" etc. When the string to check is a number the input states turns to true at the layout load even when no key is pressed.
I've put together a simple layout to test this: there's a string where you can add the letters/numbers you want to check, and the result state is shown on the display.
local displaybutton = fe.add_text("TEST",0,0,fe.layout.width,fe.layout.height*0.1)
fe.add_ticks_callback( this, "tick" )
local stringkeys = "12AB"
local keys = {}
foreach(letter in stringkeys){
keys[letter.tochar()] <- false
}
function tick( tick_time ) {
displaybutton.msg = ""
foreach (key, value in keys) {
keys[key] = fe.get_input_state(key)
displaybutton.msg = displaybutton.msg + key + ":" + value + " "
}
}
Has anyone had the same issue? Is there a different way to pass a check on number keys?