r/lua • • Dec 17 '21

lua G HUB code HELP

EnablePrimaryMouseButtonEvents(true);

function OnEvent(event, arg)
    if IsMouseButtonPressed(3) then
        PressMouseButton(4)
        Sleep(200)
        ReleaseMouseButton(4)

    end
end

someone can help me here im using G hub and mouse g502 and what i want to do is when i click my left click it will send my X1 click on my mouse.

for some reason both 4,5 not working with the PressMouseButton the only ones that work are 1,2,3,

tnx.

0 Upvotes

1 comment sorted by

6

u/AutoModerator Dec 17 '21

Hi! It looks like you're posting about Logitech. Lua is used by Logitech G-series hardware to provide advanced scripting functionality. It does this by providing an API (application programming interface) which is essentially just a set of functions that you can use to tell your hardware to do things. The subreddit dedicated to Logitech G-series hardware is /r/LogitechG.

Your first port of call should be this document, which explains in detail the functions provided by the API: https://douile.github.io/logitech-toggle-keys/APIDocs.pdf

If you've familiarized yourself with the API but are still having trouble with the language and syntax, try this page for a quick rundown of Lua's main features: https://devhints.io/lua

The full documentation for the language is provided here: https://www.lua.org/pil/contents.html

If the above resources have not answered your question, /r/Lua is the place for you! If you're just trying to do something quick and don't want to learn Lua, head across to /r/LogitechG to find others of similar purpose.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.