Virtual keys in Leadwerks

I added a snippet to the OLED project that allows you to create virtual keys using Lua in Leadwerks. You can download it here:


input = Input:Create() -- I like input as a global variable, since you use it in many places
input:SetVirtualKey("RocketBoost", "Tab", "R") -- Add custom virtual key

if input:VirtualKeyHit("RocketBoost") then System:Print("ROCKETBOOOSTING using Tab or ALt") end if input:KeyHit("E") then System:Print("E hit") end if input:KeyHit("E") then System:Print("E hit second time") end if input:KeyDown("Q") then System:Print("Q down") end if input:MouseHit("LButton") then System:Print("Left mouse button click") end if input:MouseDown("MButton") then System:Print("Middle mouse down") end if input:VirtualKeyHit("Jump") then System:Print("jump hit") end if input:VirtualKeyDown("Forward") then System:Print("moving forward using W or Up arrow") end