Recent Articles:

About Me
I love making stuff and solving puzzles. I am mak...
Lua Libraries
Here are some Lua libraries that I have used or fi...
Lua FFI
Intro :Trying to learn and standardize the Foreig...
Electronics
This section contains links to everything related ...
Lua Compiler
Some notes on the C code of the Lua Compiler Lua ...

LuaInput


Introduction

Lua Input is a Lua module written in C which allows Lua to capture and simulate mouse and keyboard events.

API

The following functions are available in LuaInput
  1. getMouse() - returns and X and Y coordinates of the current mouse cursor position
  2. setMouse(x,y) - sets the mouse cursor at the position (x,y). Returns true if successful otherwise nil and error message
  3. leftClick() - Does a left click at the current cursor position
  4. rightClick() - Does a right click at the current cursor position
  5. pressedKeys() - Returns a table with a sequence of the virtual key codes that are currently pressed
  6. setKeys(keyTable) - Presses or unpresses keys. The keycode should be the key and value if true then key is pressed, if false then key is unpressed. Returns true if successful otherwise nil and a error message.
  7. clock() - Returns a tick value which increments every micro second.

Limitations

Currently only works on windows


Copyright 2018 Milind Gupta