It is currently March 28th, 2024, 11:47 pm

Lua debugger

Discuss the use of Lua in Script measures.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Lua debugger

Post by CyberTheWorm »

Does anyone know of a debugger for Lua scripts.

I only ask because I sent a lot of time on my first script, it would be nice to see the values I'm getting while running it.
Last edited by CyberTheWorm on January 7th, 2018, 4:58 am, edited 1 time in total.
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Lua debugger

Post by jsmorley »

CyberTheWorm wrote:Does anyone know of a debugger for Lua scripts.

I only ask because I sent a lot of time on my first script, it would be nice to see the values I'm getting while running it.
There really isn't anything I know of that is some kind of official debugger, but there is good news. The print() function outputs to the Rainmeter log, so you can just:

for inc = 1, 5 do
print(inc)
end

Point is, you can output any result, any variable or table value to the Rainmeter log pretty easily. Just remember that the log will be in reverse chronological order...

What you would see in the log with the above is:

5
4
3
2
1

You could certainly write a function that outputs to a text file, and call it with LogMe('The current value of someVar is '..SomeVar), but I have never run into something that required that much effort. The print() function does a good job of telling you what it going on.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Lua debugger

Post by CyberTheWorm »

OK Thanks jsmorley
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
FormFollowsFunction
Posts: 2
Joined: April 26th, 2018, 2:29 pm

Re: Lua debugger

Post by FormFollowsFunction »

http://lua-users.org/wiki/DebuggingLuaCode

Powered by a popular search engine ! ;-)