Yep, agreed. But since we talk about it, one thing I noticed (and I'm not quite sure about the cause of it) when encountering Lua enhanced skins here on the forum, is the fact that animations done through Lua seem to take a LOT of CPU, compared to what I would envision as their Rainmeter code equivalents. What I wanted to ask someone more familiar with Lua than me is why is this happening? Faulty / inefficient implementations from skin authors, lag due to Lua-Rainmeter interconnectivity, or what? In my experience as a not great, but not bad either programmer, this shouldn't be the case, and if anything, things should be actually more efficient in Lua. Although ... if I think about it, I think it's because Lua does everything through Rainmeter, as you posted somewhere on the forum, and this is what probably leads to such behavior, right?jsmorley wrote: ↑July 13th, 2020, 4:58 pm I guess my overriding point in all of this is that there is no explicit "benefit" in avoiding Lua at all costs. To be honest, I just wouldn't waste a moment of my time saying "Ok, that's easy in Lua, but there must be some way, no matter how complicated, to do the same thing without Lua".
The beauty of Lua, the thing I like about it so much, is that you just need one measure:
And that opens up the entirety of the power of Lua for you in your skins. Then you can write one or a hundred MyFunction() calls in MyLua.lua, and use them anywhere you need them, on demand. They use no resources at all until you "call" one of them, and they can be called, in a specific and reusable way, using Inline Lua, right where and when you need the "answer".Code: Select all
[Lua] Measure=Script ScriptFile=MyLua.lua Disabled=1
As you alluded to, a [MeasureName] in Rainmeter can only have one "value" at a time. Sure you can !SetOption it and !UpdateMeasure it to change the value, but it still can only have one value at a time. So it makes it a challenge indeed to "reuse" it in multiple places, with dynamic values that adjust to "where" and "when" it is used. Inline Lua entirely solves that issue.
To me, Lua is just a part of Rainmeter, as much as IfCondition or Substitute, or any other option. Using that one measure above, all the libraries and procedural functionality Lua has are in effect added to the toolbelt you have for writing skins.
It's one of the simplest programming languages ever developed, and has a pretty low threshold for entry, even by someone who isn't a programmer.
Now mind you, I'm not going to use Lua when there is a perfectly good alternative in Rainmeter that doesn't require me to include an external .lua file with my skin. All things being equal, I'd just as soon not. But if I can do something easier or more efficiently in Lua, I'm not going to hesitate. Writing Lua code is a lot of fun for me.
