Welcome to Cockpitbuilders.com. Please login or sign up.

March 28, 2024, 06:33:45 AM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
107 Guests, 0 Users
Members
Stats
  • Total Posts: 59,639
  • Total Topics: 7,853
  • Online today: 142
  • Online ever: 582
  • (January 22, 2020, 08:44:01 AM)
Users Online
Users: 0
Guests: 107
Total: 107

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

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