0

I have been trying to use the lua scripting API that G Hub provides but I have been limited by the fact that almost no native lua functions exist (e.g. "os" and "require").

Unfortunately, I don't think that the devs update the interpreter any more (last update was 11/2020 according to the included API spreadsheet) so the only way, would be to find a solution ourselves.

So.... Is there any way to get access to the native lua functions through G Hub? I saw an extension that used luajit for some added functionality and thought of passing the functions in the global environment table but I couldn't access them in G Hub.

Jimminer
  • 9
  • 6

1 Answers1

0

This API is intended for simple macro scripting for Logitec G Series keyboards. There is no need to have access to the operating system or to load external code.

Just read https://www.lua.org/manual/5.4/manual.html#6.9 to see what you don't want some random keyboard script from the internet do on your computer.

There is no way to access or add more functionality inside that script unless you replace G Hub with your own software.

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • I am aware of the possible dangers but this will be nothing more than just a script for myself. I have a list of macros that I want to loop through using a button on my mouse. The thing is that I made a python script that displays text on the screen (to indicate the macro name) but I haven't been able to both run the script and pass the macro as a parameter. – Jimminer Sep 02 '21 at 13:15
  • @Jimminer - You can pass parameter (a string) to external application by `OutputDebugMessage`. This is how Discord integration is implemented in GHUB. – Egor Skriptunoff Sep 02 '21 at 13:52
  • @Egor How can I catch this output so I can use it on the script I wrote? – Jimminer Sep 02 '21 at 21:37
  • @Jimminer - [See this question](https://stackoverflow.com/q/58374587/1847592) – Egor Skriptunoff Sep 03 '21 at 09:19