It is currently December 11th, 2018, 2:35 pm

A poll for everyone

General topics related to Rainmeter.
User avatar
jsmorley
Developer
Posts: 18451
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: A poll for everyone

jsmorley » October 21st, 2018, 2:41 pm

eclectic-tech wrote:
October 21st, 2018, 2:37 pm
Have you looked at Mordasius's Lua example? It may provide a simple reusable solution.
The only thing I would caution is that Lua is not good with Unicode characters when using a function that depends on "position" in a string. Multi-byte Unicode characters will throw it off. Staying with the 256 ASCII / Extended ASCII characters will work fine with this approach.
User avatar
kyriakos876
Posts: 858
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: A poll for everyone

kyriakos876 » October 21st, 2018, 3:05 pm

eclectic-tech wrote:
October 21st, 2018, 2:37 pm
Have you looked at Mordasius's Lua example? It may provide a simple reusable solution.
This looks promising... would you mind explaining what is going on here:

Code: Select all

for n, s in ipairs(StreamsByViewer) do
	SKIN:Bang('!SetOption','MeterStream'..n..'','Text',string.format("%-8s %-20s %5d  %-6s %-10s",s.stream.Type,s.stream.Owner, s.stream.Viewers,center(s.stream.Races,7),center(s.stream.Rating,10)))
end   
I get it all, my only issue is that I don't get what this means:

Code: Select all

"%-8s %-20s %5d  %-6s %-10s"
I tried looking here: https://www.lua.org/pil/20.html
but didn't understand much...
User avatar
kyriakos876
Posts: 858
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: A poll for everyone

kyriakos876 » October 21st, 2018, 3:06 pm

jsmorley wrote:
October 21st, 2018, 2:41 pm
The only thing I would caution is that Lua is not good with Unicode characters when using a function that depends on "position" in a string. Multi-byte Unicode characters will throw it off. Staying with the 256 ASCII / Extended ASCII characters will work fine with this approach.
Oh wait, so the Celsius degree symbol wont work?
User avatar
jsmorley
Developer
Posts: 18451
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: A poll for everyone

jsmorley » October 21st, 2018, 3:10 pm

kyriakos876 wrote:
October 21st, 2018, 3:06 pm
Oh wait, so the Celsius degree symbol wont work?
º or ° should be ok, they are ASCII 176 / 248 and are single byte characters.
User avatar
kyriakos876
Posts: 858
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: A poll for everyone

kyriakos876 » October 21st, 2018, 3:11 pm

jsmorley wrote:
October 21st, 2018, 3:10 pm
º should be ok, it's ASCII 176 and is a single byte character.
Right... my bad :Whistle