Cockpitbuilders.com

sign up .

December 05, 2019, 09:45:41 pm

Login with username, password and session length
19 Guests, 1 User
Members
Stats
  • Total Posts: 53571
  • Total Topics: 7170
  • Online Today: 162
  • Online Ever: 427
  • (December 01, 2019, 09:15:11 am)
Users Online
Users: 1
Guests: 19
Total: 20

COUNTDOWN TO WF2020


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

LUA First question: Keyboard events....

Started by RayS, November 20, 2015, 11:54:20 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RayS

This is more abstract and deals with functionality.

I downloaded the SimInnovation gauge suite and it's all based on LUA programming.

Does LUA have a library/facility to work with keyboard events? I see facilities for Joystick events which has me thinking. With regard to rotary encoders, they need to be spun with some vigor sometimes. My concern is that if the rotaries use joystick events, that the overall joystick architecture will end up missing a lot of those button events, while my experience has shown that working with keyboard events is a lot cleaner.

Can anyone share their experiences?
Ray Sotkiewicz

Trevor Hale

Ray,

Lua itself does not natively accept inputs. But like arduino there are library's you can import.

Take a look at the io library, which by default has standard-input as the default input file:

http://www.lua.org/pil/21.1.html

Quote
local answer
repeat
   io.write("continue with this operation (y/n)? ")
   io.flush()
   answer=io.read()
until answer=="y" or answer=="n"


Trev

Trevor Hale

Owner
http://www.cockpitbuilders.com

Director of Operations
Worldflight Team USA
http://www.worldflightusa.com

VATSIM:

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate