Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Integrating Lua into AutoHotkey


  • Please log in to reply
38 replies to this topic
Tuncay
  • Members
  • 1945 posts
  • Last active: Feb 08 2015 03:49 PM
  • Joined: 07 Nov 2006
The two different operators := and = should be definetely merged, because it confuses beginners so much, I thinked in the past. But If I think further, then I came to the result, that the simple assignment methode with = can be really helpful.

Construct like:
words = "%w1%" is not "%w2%", but "%w3%" is.
looks very natural.

Construncts with quoting in example looks ugly and unreadable and is hard to write in some situations:
words := """" . w1 . """ is not """ . w2 . """, but """ . w3 . """ is".


  • Guests
  • Last active:
  • Joined: --

Construncts with quoting in example looks ugly and unreadable...

...I agree that "doubling up the quotes" as a means to "escape" them is unintuitive & unreadable...I would prefer...

;single-quotes, for when you need doubles inside...
words='"'+w1+'" is not "'+w2+'", but "'+w3+'" is.'

;double-quotes, but escape the other doubles: this way...
words="`""+w1+"`" is not `""+w2+"`", but `""+w3+"`" is."

;double-quotes, but escape the other doubles: or this way...
words="""+w1+"" is not ""+w2+"", but ""+w3+"" is."

;parse % or $ vars in double quotes, but not in single quotes...(vars replaced)...
words="`"%w1%`" is not `"%w2%`", but `"%w3%`" is."

;parse % or $ vars in double quotes, but not in single quotes...(vars NOT replaced, use option 1, concatenation not in-string %'s)...
words='"%w1%" is not "%w2%", but "%w3%" is."'
...granted some or most of those are equally unreadable, but really quoting vars inside a string like that is really just problematic anyway...I don't normally include double quotes in my resulting vars/msgbox's/error messages...I guess continuation sections are the most elegant for this...

;continuation section...
words=
(LTrim
	"%w1%" is not "%w2%", but "%w3%" is.
)
...no escaping...I use single-line (technically 4-line) continuation sections anytime I don't wanna spend time escaping chars...which is never, I never escape more than 3 chars in a string without re-doing it to a continuation section...for completeness, if you wanted the % (percents) in the resulting string & not to be resolved as vars...

;continuation section...literal %'s...
words=
(LTrim %
	"%w1%" is not "%w2%", but "%w3%" is.
)


tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: Apr 19 2019 05:49 PM
  • Joined: 21 Dec 2007

What's so insane about the current methods? They are very simple...

They are unintuitive, error prone and generaly very limited in expressivness. You also don't have some basic programming mechanisms.

It didn't matter much when AHK was generaly used for 10 - 50 line scripts. Today AHK is used more broadly so now it does matter.

Also, Lua is separately developed wich means that functionality could change on its own, and language on its own by the team of dedicated ppl.

About "simple" part, to me, Lua is easier to learn and understand.

AMEN :)
simply couldnt be more well put
I have in my job several people with some limited programming skill and ahk is just wringing there necks. :twisted: But all agree its usefulness so they plug thru the unintuitive problematic code structure any how
Never lose.
WIN or LEARN.

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

The two different operators := and = should be definetely merged, because it confuses beginners so much, I thinked in the past. But If I think further, then I came to the result, that the simple assignment methode with = can be really helpful.

Construct like:

words = "%w1%" is not "%w2%", but "%w3%" is.
looks very natural.

Construncts with quoting in example looks ugly and unreadable and is hard to write in some situations:
words := """" . w1 . """ is not """ . w2 . """, but """ . w3 . """ is".

I think you may be missing the point with the quoted % variable usage. Mixing the 2 methods has advantages when writing dynamic code. The advantage comes when referencing another variable instead of referencing the contents of the variable.

a = hello ; yawn...
a := "hello"  ; yawn...

blah = a
%blah% = hello ; boring example but adds more functionality since it uses the variable that has the same name as the value of blah instead. 

a := %blah% . " world" ; another boring example but also additional functionality

Other methods could be used to achieve the same results but the existing methods are soooo simple...

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Also, Lua is separately developed wich means that functionality could change on its own, and language on its own by the team of dedicated ppl.

About "simple" part, to me, Lua is easier to learn and understand.

Out of curiosity, have you asked the lua team if they would like to add AutoHotkey functionality to lua? I'm assuming that much of AutoHotkey's functionality is currently missing in lua or I'd think that you would just use lua instead. I'm not sure I understand why you'd suggest that AutoHotkey should implement lua's syntax instead of adding additional functionality to lua if you prefer lua's syntax/functionality in general...

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006

Out of curiosity, have you asked the lua team if they would like to add AutoHotkey functionality to lua?


Perhaps at this point, you would like to inform yourself a bit more about Lua.
Posted Image

Zippo()
  • Guests
  • Last active:
  • Joined: --

Perhaps at this point, you would like to inform yourself a bit more about Lua.


If you really want Lua integrated, start a new branch or something with AHK.

Don't try to force that language on those of us who don't want it.

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Or even better: create an AutoHotkey.dll, than you can use any other language you like.

majkinetor
  • Moderators
  • 4512 posts
  • Last active: Jul 29 2016 12:40 AM
  • Joined: 24 May 2006

If you really want Lua integrated, start a new branch or something with AHK.
Don't try to force that language on those of us who don't want it.

I didn't create this thread, I am just rationaly thinking about this topic, thats all, far away from forcing it. I don't want anything, nor I am going to do anything about it ATM. I am just saying its a good idea knowing both Lua and AHK.

Second, there are bunch of ppl here and there were bunch of ppl before having poistive opinion about that, and I actually heard about Lua on this very place. Contrary to corrupt who doesn't know anything about it and still feels free to comment, I actually did my homework and even more. That was the point of my comment to him. If he knew anything about Lua, he wouldnt ask me, nor comment things like he did, even trying to be funny.

In advance, If you don't have anything constructvely too add to the topic instead whining, please ignore what I say.

At the end, you don't have to have IQ 200 to deduce that Lua will never see this place, its just theoretical discussion.
Posted Image