ButtKoWitz
Member
- Joined
- Mar 23, 2023
- RedCents
- 342¢
New to Lua and MQ so be patient
...
I'm a little confused about when to include, or not, the final parenthesis when building an mq.TLO... call. The Lua Scripting in MacroQuest guide offers some info towards this, and definitely says "append () to the end to finally bring the result into lua"
(specifically here: https://docs.macroquest.org/lua/#tlo-bindings ). But where I'm confusing myself is when I'm looking over the example Lua scripts I see sometimes the mq.TLO... calls have extra ending parens, and sometimes not (most times not).
Two example scripts that come with default install of MQ) that have me confused are:
PackageMan.Lua ...
[CODE title="Line 28"]local cliInstallPath = mq.TLO.Lua.Dir('modules')() .. '\\luarocks'[/CODE]
Are the final parens necessary, as ...Dir('modules') seems to me to be the closing set.
The other confusing call is:
autoassist.Lua
[CODE title="Line 5"]local groupAssist = function () return mq.TLO.Me.GroupAssistTarget end -- Note the lack of parentheses here[/CODE]
Umm o.k. But why am I'm noting the "lack of parens here"?
Thanks!
...I'm a little confused about when to include, or not, the final parenthesis when building an mq.TLO... call. The Lua Scripting in MacroQuest guide offers some info towards this, and definitely says "append () to the end to finally bring the result into lua"
(specifically here: https://docs.macroquest.org/lua/#tlo-bindings ). But where I'm confusing myself is when I'm looking over the example Lua scripts I see sometimes the mq.TLO... calls have extra ending parens, and sometimes not (most times not).
Two example scripts that come with default install of MQ) that have me confused are:
PackageMan.Lua ...
[CODE title="Line 28"]local cliInstallPath = mq.TLO.Lua.Dir('modules')() .. '\\luarocks'[/CODE]
Are the final parens necessary, as ...Dir('modules') seems to me to be the closing set.
The other confusing call is:
autoassist.Lua
[CODE title="Line 5"]local groupAssist = function () return mq.TLO.Me.GroupAssistTarget end -- Note the lack of parentheses here[/CODE]
Umm o.k. But why am I'm noting the "lack of parens here"?
Thanks!

