Log In  

In short, this code works:

function _init()
    poke(0x5f2d,3)
end

function _update()
    if stat(30) then
        -- prints the pressed key
        local key=stat(31)
        printh(key)
    end
end

And this doesn't:

function _init()
    poke(0x5f2d,3)
end

function _update()
    if stat(30) then
        -- prints nothing, not even a blank line
        printh(stat(31)
    end
end
P#100846 2021-11-26 19:31 ( Edited 2021-11-26 19:32)

stat(31) return two values - it seems to be a bug (or an undocumented feature).
Try a additional brace around stat(31)

printh( (stat(31)) )

P#100850 2021-11-26 20:23

Oh my, I actually read that it returned 2 values, it just didn't occur to me that it would affect the printh()...

Thanks!

P#100851 2021-11-26 20:39

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-26 20:15:17 | 0.009s | Q:12