It is currently March 28th, 2024, 1:31 pm

A poll for everyone

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

Re: A poll for everyone

Post by jsmorley »

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: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: A poll for everyone

Post by kyriakos876 »

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: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: A poll for everyone

Post by kyriakos876 »

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: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: A poll for everyone

Post by jsmorley »

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: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: A poll for everyone

Post by kyriakos876 »

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
Post Reply