KeyPress event in Lua?

Is it possible to get users to click on lua? Fe.

while true do
    if keyPress(27)==true then
        print("You just pressed ESC")
    end
end
+2
source share
4 answers

Lua is based on extreme mobility. Essentially, it is based on delivering, essentially, only the one that is available in ANSI C in terms of capabilities. (I think the only exception is dynamic binding, which is a feature other than ANSI, not available on all platforms, but so useful that they introduced it to many.)

ANSI C does not provide keystroke functionality, so the default Lua library also does not work.

, LuaRocks . , , ltermbox, LuaRocks, . (, , , .) . .

Lua - . . , , .

+6

getkey() NTLua. .

( getch())

+2

Lua. , .

+1
source

It seems you are trying to make a game. For 2D games, you can consider love2d . It looks a little strange, but works, and it is relatively easy compared to other languages ​​such as C.

+1
source

All Articles