It is currently April 26th, 2024, 12:58 am

[HELP] Set string value?

Discuss the use of Lua in Script measures.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

[HELP] Set string value?

Post by smurfier »

Is there no longer a function to directly set the value of a string meter with Lua?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set string value?

Post by jsmorley »

smurfier wrote:Is there no longer a function to directly set the value of a string meter with Lua?
Sorry, we are trying to get a head start on some manual changes so we don't have to try to do it all at once tomorrow...

You can still use SetText as before, but stay tuned... Only 12 hours more or less until that will be depreciated. You are about to get the entire orchestra, not just one bassoon.

In the meantime, SetText is still here: http://rainmeter.net/cms/LuaScripting
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Set string value?

Post by smurfier »

I'm trying to make a calendar using Lua and it's not working. I'm getting #Extra Operation! in the about dialog.

Code: Select all

PROPERTIES =
{

}

function Initialize()
	Meters = {}
	for a=1,42 do
		Meters[a]=SKIN:GetMeter("mDay"..a)
	end
end -- function Initialize

function Update()
	Month= os.date("%m")
	Year= os.date("%Y")
	when = os.time({year=Year, month=Month, day=1})
	StartDay = os.date("%w", when)
	for a=1,42  do
	b = a - StartDay
	Meters[a]:SetText(b)
	end
return StartDay
end -- function Update
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set string value?

Post by jsmorley »

smurfier wrote:I'm trying to make a calendar using Lua and it's not working. I'm getting #Extra Operation! in the about dialog.
That error is from the skin, not the Lua, and means there is a problem with a Calc somewhere. Either in a Measure=Calc or in an embedded formula.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Set string value?

Post by smurfier »

Alright... I cleaned out all the measures as they were unnecessary and the meters still have no value.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set string value?

Post by jsmorley »

smurfier wrote:Alright... I cleaned out all the measures as they were unnecessary and the meters still have no value.
Nothing looks obviously wrong to me in your Lua. Couple of things that I would look at:

Be sure "b" is returning what you think it is. Just put a "print(b)" in there somewhere and look in the log.
Be sure your meters do NOT have DynamicVariables=1 on them. That won't work with SetText().
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Set string value?

Post by smurfier »

It was DynamicVariables.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set string value?

Post by jsmorley »

smurfier wrote:It was DynamicVariables.
Won't be a problem in 12 hours... DynamicVariables is about to become about 80% irrelevant.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Set string value?

Post by smurfier »

Well...I've got it displaying the day numbers correctly and I think I'm going to wait for tomorrows changes before going any further. This really is a whole lot easier with lua.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .