It is currently March 29th, 2024, 11:11 am

BUGs Padding and Inline Lua

Report bugs with the Rainmeter application and suggest features.
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

BUGs Padding and Inline Lua

Post by ~Faradey~ »

So as far as i tested picture is not displaying if Top and Bot values of padding equals meter H size
Tested with different pictures and formats: png; jpg

Code: Select all

[BUG]
Meter=Image
ImageName=rss.png
SolidColor=0,200,150
W=100
h=100
Padding=5,50,5,50
same here

Code: Select all

[BUG]
Meter=Image
ImageName=rss.png
SolidColor=0,200,150
W=10
H=10
Padding=5,5,5,5
Now for Inline Lua. Looks like it doesn't like function names with underscore symbol at beginning. didn't investigate further tho...This bug may not require be fixed, just have a statement in documentation about restricted characters or something
this works fine and returns 10 as expected

Code: Select all

[MeterTest]
Meter=STRING
X=0
Y=0
SolidColor=063B6A
FontColor=D3E6E1
Text="output: [&script:testFunc()]"
StringAlign=LEFT
FontSize=20
FontFace=Arial
AntiAlias=0
DynamicVariables=1

[script]
Measure=Script
ScriptFile="#CURRENTPATH#script.lua"
UpdateDivider=-1
this returns 0 but should return 5

Code: Select all

[MeterTest]
Meter=STRING
X=0
Y=0
SolidColor=063B6A
FontColor=D3E6E1
Text="output: [&script:_testFunc()]"
StringAlign=LEFT
FontSize=20
FontFace=Arial
AntiAlias=0
DynamicVariables=1

[script]
Measure=Script
ScriptFile="#CURRENTPATH#script.lua"
UpdateDivider=-1

Lua

Code: Select all

function testFunc()
	return 10
end

function _testFunc()
	return 5
end
Am i doing something wrong?
4.2.0 beta r3001 64-bit (Nov 19 2017)
Windows 7 Enterprise 64-bit (build 7601) Service Pack 1
Path: C:\Program Files\Rainmeter\
IniFile: C:\Users\FaradeyUA\AppData\Roaming\Rainmeter\Rainmeter.ini
SkinPath: C:\Users\FaradeyUA\Documents\Rainmeter\Skins\
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: BUGs Padding and Inline Lua

Post by jsmorley »

This isn't something specific to our implementation of Lua, but is standard Lua behavior.

http://lua-users.org/wiki/LuaStyleGuide

Lua internal variable naming - The [Lua 5.1 Reference Manual - Lexical Conventions] says, "As a convention, names starting with an underscore are reserved for internal global variables used by Lua." These are often constants but not necessarily, e.g. _G.

As to the Padding issue, I don't follow...
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: BUGs Padding and Inline Lua

Post by ~Faradey~ »

jsmorley wrote:This isn't something specific to our implementation of Lua, but is standard Lua behavior.

http://lua-users.org/wiki/LuaStyleGuide

Lua internal variable naming - The [Lua 5.1 Reference Manual - Lexical Conventions] says, "As a convention, names starting with an underscore are reserved for internal global variables used by Lua." These are often constants but not necessarily, e.g. _G.
ahh i completely forgot about global variables in lua, makes sense
jsmorley wrote:As to the Padding issue, I don't follow...
The image is simply disappearing if Padding=5,5,5,5 and H=10 (5+5=10 :) )
but if i update meter with !UpdateMeter it will appear hmm...
[BUG]
Meter=Image
ImageName=rss.png
SolidColor=0,200,150
W=10
H=10
Padding=5,5,5,5
but will appear if you change it to
Padding=5,5,5,6

May be it is on my end...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: BUGs Padding and Inline Lua

Post by jsmorley »

~Faradey~ wrote:ahh i completely forgot about global variables in lua, makes sense


The image is simply disappearing if Padding=5,5,5,5 and H=10 (5+5=10 :) )
but if i update meter with !UpdateMeter it will appear hmm...


but will appear if you change it to
Padding=5,5,5,6

May be it is on my end...
What is the actual size of rss.png?
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: BUGs Padding and Inline Lua

Post by ~Faradey~ »

jsmorley wrote:What is the actual size of rss.png?
15x15 (attached)
but it doesn't matter, as i said i tried various pictures with different size and format same result
will do testing again

rss.zip
You do not have the required permissions to view the files attached to this post.
Last edited by ~Faradey~ on December 20th, 2017, 5:49 pm, edited 2 times in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: BUGs Padding and Inline Lua

Post by eclectic-tech »

What I am seeing is:

If the sum of the padding for top and bottom equal the H setting in the meter, only the padding is being displayed, but not the image.

If the sum of the padding for left and right equal the W setting in the meter, only the padding is being displayed, but not the image.

And I am not using lua

Code: Select all

[BUG]
Meter=Image
ImageName=rss.png
SolidColor=255,255,0
W=10
h=100
Padding=5,50,5,50

[BUG2]
Meter=Image
ImageName=rss.png
SolidColor=255,255,0
X=r
Y=10R
W=10
H=10
Padding=5,5,5,5
Very strange!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: BUGs Padding and Inline Lua

Post by jsmorley »

Try putting DynamicVariables=1 on the [BUG] meter.

Code: Select all

[BUG]
Meter=Image
ImageName=#@#Images\grr.png
SolidColor=0,200,150
W=10
H=10
Padding=5,5,5,5
DynamicVariables=1
I'm not entirely sure why it wants/need that. I'll have to check with Brian.

Without the DynamicVariables=1:
1.png
With DynamicVariables=1:
2.png
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: BUGs Padding and Inline Lua

Post by eclectic-tech »

Adding DynamicVariables=1 corrects...
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: BUGs Padding and Inline Lua

Post by ~Faradey~ »

eclectic-tech wrote:Adding DynamicVariables=1 corrects...
it does hmm

ok problems solved Thank you all
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: BUGs Padding and Inline Lua

Post by jsmorley »

This does feel like a bug to me. I see nothing about that meter

Code: Select all

[BUG]
Meter=Image
ImageName=rss.png
SolidColor=0,200,150
W=10
H=10
Padding=5,5,5,5
That intuitively indicates that DynamicVariables=1 should be required. Every bit of it is hard-coded. If there is some reason, something that is unavoidable in the way things are done in a particular order, we need to find a way to define a "rule" that we can document.