True! With qualification...
I've played around with that Lua shading script a lot. Sometimes I just type nonsense into it, to see what will happen.
For the most part, Lua is quite forgiving of sloppy coding. However...
In my experience, the 'nil' problem kicks up when you (accidentally, or on purpose) try to change a character inside a string value, without using a subroutine, e.g. create a new string. Lua tables are mutable, but not the strings.
When you attempt to do this, Lua says FU, and gives you 'the finger'.
If there's a way of recovering from "those pesky nil value errors" (other than rebooting) I've yet to discover it.
Personally, I *think* it has something to do with the memory management in Lua. Since Lua strings are immutable, they effectively become 'read only'. Lua allows you do do a certain amount of destroying and garbage collection, but I haven't found the cure for getting rid of 'nil' errors, on the trot.
Intel ® P4 Extreme Edition 3.4 (Gallatin) || DFI ® LanParty PRO875B rev B1
Crucial ® Ballistix Tracer PC4000 1GB || Mountain Mods U2-UFO Opti-1203
XFX 7600GT 560M AGP (PV-T73A-UDF3) || Corsair HX520W Modular PSU
Nil is the type of the value nil, whose main property is to be different from any other value; it usually represents the absence of a useful value
http://www.lua.org/manual/5.1/manual.html#2.2
when you start a conky that is calling a lua script and you get the nil value error, just open up another terminal and killall conky... then edit the lua to get rid of the error... most of the time, for me at least, its just been a mistake in the script... correct, save, start conky, look for errors... repeat if necessary
sometimes you get the nil when you have everything right...then you just need something like
to stop the error... if I had to reboot every time I got the nil value error when testing a lua script I would go insane!Code:if x==nil then x=0 end
edit - use the print function liberally if you can't figure out whats going wrong
Code:print(x)
Last edited by mrpeachy; January 2nd, 2011 at 02:29 AM.
On have a minute...
I agree that 'nil' is "a type of value", but that's not what we're talking about here.
We're talking about a 'dofile' error -- and 'dofile' doesn't shoot errors. It simply throws a 'nil' at you -- usually, because a syntax error in your code.
Wash, rinse, and repeat usually doesn't do the trick for me!
Anyway, I'll read this more thoroughly later. Gotta jet...
Intel ® P4 Extreme Edition 3.4 (Gallatin) || DFI ® LanParty PRO875B rev B1
Crucial ® Ballistix Tracer PC4000 1GB || Mountain Mods U2-UFO Opti-1203
XFX 7600GT 560M AGP (PV-T73A-UDF3) || Corsair HX520W Modular PSU
you do get an error reported... i took the bg script, deleted a bracket and launched it in conky and i get this....
the nil value line keeps repeating and there is no info along with it, but at the very top is the helpful bitCode:Conky: llua_load: /home/mcdowall/lua/test.lua:43: ')' expected near 'return' Conky: desktop window (18000aa) is subwindow of root window (18f) Conky: window type - override Conky: drawing to created window (0x3600001) Conky: drawing to double buffer Conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value Conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value Conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value Conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value Conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value Conky: llua_do_call: function conky_draw_bg execution failed: attempt to call a nil value
the repeating line usually pushes it out of view quickly so you have to scroll back
Last edited by mrpeachy; January 2nd, 2011 at 03:35 AM.
I'm gonna add my 2 cents about lua here:
From what I have read it seems to be a rather easy language to work with and have seen people pick up working with the scripts in a couple hours. I use lua in conky on my laptop for 6 rings that measure battery, cpu's, etc. I have used to draw_bg.lua too for a little bit but I'm not really a fan of shaded backgrounds. I like integration into the desktop background better. but anyways I have never had a memory problem but I have had a couple problems with the nil value thing. It doesn't seem to bother me and I think what lua can do in conky is awesome. I'm currently gettin one of mrpeachy's scripts working of his mayan calendar but I don't think it is too difficult to restart your conky once a day to get the memory problem fixed. just my two cents.
I'm a super power user
Hi everyone. How are you all enjoying the new year?
I love playing with Conky but the problem is that I find that it takes up my time to a point that I don't get other things done.
Anyway, I have need some assistance with something. I'm running the following line on my cpu bars to make them look more interesting;
But I also want to run it on the RAM and HDD bars, It works fine on the cpubars but when I try to adapt it for the RAM or HDD it doesn't fully work. I've tried all sorts combinations in the script to get it to work but no success. But I'm no expert either. Can someone help me please?Code:${if_match ${cpu}<=50}${color green}${else}${if_match ${cpu}<=70}${color orange}${else}${if_match ${cpu}>70}${color red}
Ubuntu 16.04 / Linux 18
“To mess up a Linux box, you need to work at it; to mess up your Windows
box, you just need to work on it”.
whats going wrong? -- your above line is missing its endifs by the way...
seems like you just need to copy the line and replace all instances of cpu with memperc or whatever...
and it should look like this:
you were missing the ${cpu} after the color... nothing was getting displayed because of thatCode:${if_match ${cpu}<=50}${color green}${cpu}${else}${if_match ${cpu}<=70}${color orange}${cpu}${else}${if_match ${cpu}>70}${color red}${cpu}${endif}${endif}${endif}
...or you could just have one ${cpu} at the end of the line... lots of ways to achieve the same ends using if's
Last edited by mrpeachy; January 2nd, 2011 at 07:19 AM.
Sorry thats my sloppy copy/paste job. It does have all the right endifs in the conky script.
Yea I copied the whole thing (inc the endifs) and pasted it in front of the fs_bars etc, and changed all the ${cpu} to ${fs_used} or what ever it was that I was applying it to but it wouldn't work correctly the most it would do is change the colour but it stays that colour and wouldn't change to each stage.
i.e. I have a HDD thats almost full but it was showing green in stead of red.
I tried changing the ordering, the values and even which the < were facing. the most I got out of any of that was that it changed the colour to orange. but still no changing for each stage. what am I missing?
Ubuntu 16.04 / Linux 18
“To mess up a Linux box, you need to work at it; to mess up your Windows
box, you just need to work on it”.
Bookmarks