Page 1 of 1

Lua debugger

Posted: January 7th, 2018, 12:36 am
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.

Re: Lua debugger

Posted: January 7th, 2018, 12:46 am
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.

Re: Lua debugger

Posted: January 7th, 2018, 4:59 am
by CyberTheWorm
OK Thanks jsmorley

Re: Lua debugger

Posted: May 29th, 2018, 11:37 am
by FormFollowsFunction
http://lua-users.org/wiki/DebuggingLuaCode

Powered by a popular search engine ! ;-)