Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 27

Lua Scripting • Re: Double error?

$
0
0
Because of the combination of the error('some text') call being logged and Rainmeter reacting to the error('some text'). It's a bit strange, but Rainmeter is both reacting to the error function wanting to log an error, and the error function telling Rainmeter to log an error. It's really sort of a bug in my view.

Personally, I would not use the error() function. I would just use print() to write to the log.

That is really an invalid Lua script file for Rainmeter, as Rainmeter REQUIRES a return value to be given. The error() function will short-circuit the script, log the error (twice) and just die, but it's not the right way to do it. I'm pretty sure it will eventually cause some instability to yank the rug out from under the Lua > Rainmeter API like that.

Code:

function test()print('there is an error: test')return 0end
Alright, I noticed it really needed the return while I was testing a function and it would write a wrong result to a file, it took me some time to realize the problem was it really doesn't like having no return, I was just ignoring the no return error because I was just testing. I guess it was running the iteration twice which was causing an incorrect result.

Shame, I really like the error function. Hopefully a workaround/fix is found.

Thank you :thumbup:

Statistics: Posted by RicardoTM — January 17th, 2025, 5:14 am



Viewing all articles
Browse latest Browse all 27

Trending Articles