It is currently March 28th, 2024, 12:06 pm

LUA data is nil

Get help with installing and using Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LUA data is nil

Post by balala »

mworsnop wrote:Here is the complete INI and LUA.
Without the ApiKey.
mworsnop
Posts: 16
Joined: December 14th, 2017, 1:20 am

Re: LUA data is nil

Post by mworsnop »

Yes I left that out as its registered to me. I will send you my key in PM
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LUA data is nil

Post by balala »

I'm sorry, but something is still going wrong. Loading your skin with the given variables, still gives a RegExp matching error (-1) error (about the [WeatherForecast] measure). Trying to open the posted URL in a web browser (again, replacing the variables with the appropriate given values), doesn't open anything, just this:

Code: Select all

<?xml version="1.0"?>
-<response>
	<version>0.1</version>
	<termsofService>http://www.wunderground.com/weather/api/d/terms.html</termsofService>
	-<features>
		<feature>alerts</feature>
	</features>
	-<error>
		<type>unknownfeature</type>
	</error>
	<alerts> </alerts>
</response>
So, I'm not sure what's going on, maybe the needed URL isn't accessible for me (outside of US)?
mworsnop
Posts: 16
Joined: December 14th, 2017, 1:20 am

Re: LUA data is nil

Post by mworsnop »

Those errors are both correct. There are no descriptions as there are no alerts.

The URL is correct. There are no alerts right now.

But in the LUA I should be able to do the print and see the weatherData var so I can see if its working.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LUA data is nil

Post by balala »

mworsnop wrote:But in the LUA I should be able to do the print and see the weatherData var so I can see if its working.
Where? I mean where would you like to see weatherData? Using the print function probably works in standalone used lua (however I never workd so, so I'm not sure), but not here. To can see the data through the Rainmeter skin, you should have to use instead of the print function a this kind of command: SKIN:Bang('!SetOption', 'MyStringMeter', 'Text', weatherData). This command sets the Text option of the [MyStringMeter] meter, which you must have in the code of your skin. Something like:

Code: Select all

[MyStringMeter]
Meter=STRING
X=0
Y=0
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Obviously you can use here any options you'd like, this is just an example. Important is that this meter doesn't have a Text option, which isn't needed, because it is set by the above lua command.
mworsnop
Posts: 16
Joined: December 14th, 2017, 1:20 am

Re: LUA data is nil

Post by mworsnop »

In the LUA I would like to see weatherData print to the log. weatherData should be the data that was returned from the URL.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LUA data is nil

Post by balala »

mworsnop wrote:In the LUA I would like to see weatherData print to the log. weatherData should be the data that was returned from the URL.
Well, I have no idea how you could send information directly from the lua script to the log of Rainmeter. From the Rainmeter skin it can be (through the !Log bang), but I doubt you could from the .lua script. I don't say precisely you can't, I say just that I don't know how. Maybe someone else how knows will come to help.
Sorry...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LUA data is nil

Post by jsmorley »

balala wrote:Well, I have no idea how you could send information directly from the lua script to the log of Rainmeter. From the Rainmeter skin it can be (through the !Log bang), but I doubt you could from the .lua script. I don't say precisely you can't, I say just that I don't know how. Maybe someone else how knows will come to help.
Sorry...
The print() command in Lua outputs to the Rainmeter log.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: LUA data is nil

Post by balala »

jsmorley wrote:The print() command in Lua outputs to the Rainmeter log.
Indeed. I had no idea about this. But it indeed does.
Thanks for the info.
Post Reply