Page 1 of 1

LuaMacros bug and initial feedback

Posted: 15 May 2015, 21:26
by OtakuFargo
Greetings Petr. I understand your desire to move on to LuaMacros. It looks like a very exciting project. I hate working on GUIs too! I don't know if you're familiar with the phrase but when I read your announcement I thought "follow your bliss." HidMacros has helped me achieve a dream that I had for years but couldn't execute. I use AutoHotkey like a madman and one keyboard was getting pretty cramped. I now how 3 full keyboards and two gamepads at work. I have shortcuts mapped all over the place. Without HidMacros, this was impossible. I'm delighted to find that LuaMacros, with just a little (fun) work, is already doing more than HidMacros. The big thing that I've worked out is how to use any key as a modifier for any other key. I also have multi key combos recognized. It's all slipped very well into the spot HidMacros lived in my solution.
As a bit of a side note, I am really appreciating your choice of Lua. I'd run into it a couple years ago in SciTE, my text editor of choice for AutoHotkey but I didn't do much with it. It definitely seems to be on the rise.
Phew, so thank you so much! I've got some bills coming up but after that, I owe you a donation :)
Lastly a question and a bug. I'm not sure how error handling is supposed to work in Lua but it seems like errors are being caught and suppressed inside the function passed into lmc_set_handler. This is a simple example. If I put an improperly escaped pattern string like this at the top of my script (should be "%%(" at the end), it hits the line, prints an error, and stops. Like you'd expect:

Code: Select all

cleanThisKey=cleanThisKey:gsub("%(","%(")
Once it's in the anonymous function though, it'll stop executing there, but the error message doesn't print out in the display.

Code: Select all

lmc_set_handler("Razer",function(button, direction)
		cleanThisKey=cleanThisKey:gsub("%(","%(")
end)
From the bit I've read about Lua, I think that might be by design. Or maybe you are trapping the errors and not printing them out. I don't know. Anyone have any suggestions.
Lastly, what I am pretty sure is a bug. If I close out AutoHotkey (to simplify) and open LuaMacros, without loading a script or anything, something goofy happens to my alt key. At the minimum, when I press alt and an arrow key for navigation in Firefox or Visual Studio, when I release alt it types these characters: ♦♠◘☻. A diamond, spade, box, and face. Again, there is no Lua script loaded. This is happening on my "plain" keyboard so even if a script were running, it wouldn't be binding to that keyboard. The behavior also stops as soon as I close LuaMacros. I use those shortcuts in visual studio a lot so hopefully you can get it sorted out. I just checked, it does the exact same thing in Notepad too which normally doesn't do anything with those shortcuts.
So, thanks again. The work you've done has changed my life. It's brought me much joy.

Re: LuaMacros bug and initial feedback

Posted: 16 May 2015, 20:20
by admin
Thanks for those positive words :-)

To your points: you're right, I didn't care about error handling at all, it's one of the things at my todo list. These days I'm rewriting Xplane communication, once it's done I can have a look.

Regarding the alt hey I have troubles to simulate it. Do I need AHK? I don't have it installed. What I tried was to start LuaMacros, switch to notepad and press & release left alt key but it didn't print any characters...

Re: LuaMacros bug and initial feedback

Posted: 18 May 2015, 16:13
by OtakuFargo
Ah, you are close. I don't think you'll need AHK. While holding alt, press and release an arrow key, and then release alt. It reminds me of how in older versions of windows you could hold alt, type a numeric character code or whatever on the numpad, and as soon as you released alt it'd show up. I don't suspect it's related but the behavior is similar. Aside from arrow keys vs numpad numbers.

Re: LuaMacros bug and initial feedback

Posted: 04 Jun 2015, 22:40
by admin
I finished rewrite of XPL plugin so had some time to check your issues.
Regarding wrong escaping - I see no problem here. The error is reported once the code is executed. From LUA syntax point of view there's nothing wrong with your gsub arguments. The parameters are regular strings. So if you execute call with defined callback there's no reason to report error because handler code is not executed at that time. The error comes once the code is executed and I believe (didn't test) you would get the same error once you trigger the callback function.

Regarding strange characters being sent to active application: I was able to reproduce this behaviour so will have a closer look now. Not easy but seems to be caused by LuaMacros, so there must be something wrong with message handling...

Re: LuaMacros bug and initial feedback

Posted: 21 Nov 2015, 00:31
by admin
Finally finally finally ... I found root cause of this weird behaviour with strange characters on alt+arrow.
The latest build 0.1.0.233 should solve the issue.
Download link is still the same, please check.

Re: LuaMacros bug and initial feedback

Posted: 02 Oct 2019, 14:22
by barrow
Downloading it now!