You are not logged in.

#1 2012-03-25 01:02:08

runny6play
Member
Registered: 2012-02-18
Posts: 85

conky-lua problem

I used this as a lua script guide for conky (semi-relvent)
error message I can't resolve with my current lua knowledge or though research/script reading.

Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value

conky config

# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

######################
# - Conky settings - #
######################
update_interval .5
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1

imlib_cache_size 0
double_buffer yes
no_buffers yes
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:size=9
override_utf8_locale yes
text_buffer_size 2048

#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
#own_window_argb_visual yes
#own_window_argb_value 100
alignment bottom_right

alignment tr
gap_x -2
gap_y 180
minimum_size 350 300


default_bar_size 100 8


draw_shades no

default_color efefef
default_shade_color 1d1d1d
############################
background no
border_width 1
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_graph_borders yes
draw_outline no

out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
own_window_type desktop
stippled_borders 0
update_interval 1.0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no

lua_load ./conky_outline.lua
lua_draw_hook_post main

TEXT
$alignc CPU


#${scroll 16 $nodename - $sysname $kernel on $machine | }
#$hr
#${color grey}Uptime:$color $uptime
#${color grey}Frequency (in MHz):$color $freq
#${color grey}Frequency (in GHz):$color $freq_g
#${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
#${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
#${color grey}CPU Usage:$color ${cpu cpu0}% ${cpugauge 0}
#${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
#$hr
#${color grey}File systems:
# / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
#${color grey}Networking:
#Up:$color ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0}
#$hr
#${color grey}Name              PID   CPU%   MEM%
#${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
#${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
#${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
#${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}

the lua script giving the errors

--[[line_width=5
top_left_x=20
top_left_y=20
rec_width=50
rec_height=50
red=1
green=0
blue=0
alpha=1 ]]
--draw it
require 'cario'
line_width=5
top_left_x=20
top_left_y=20
rec_width=50
rec_height=50
red=1
green=0
blue=0
alpha=1
function conky_main()
 if value == nil then value = 0 end
pct = value/pt['max']
if conky_window == nil then return end
 
  --local updates = conky_parse('${updates}')
   -- update_num = tonumber(updates)
    
--if updates_num>5 then
 cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
--local updates=tonumber(conky_parse('${updates}')

cairo_set_line_width (cr,line_width)
cairo_rectangle (cr,top_left_x,top_left_y,rec_width,rec_height)
cairo_set_source_rgba (cr,red,green,blue,alpha)
--end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

ra
backgroud for anybody that cares.
Ive been trying to learn enough about lua and conky enough to make my own lua script for conky for flexabilty reasons. I want to be able to draw the background with lua which is what im trying to do here as a proof of concept.

Offline

#2 2012-03-25 05:28:58

rockin turtle
Member
From: Montana, USA
Registered: 2009-10-22
Posts: 227

Re: conky-lua problem

Just a guess, but try to give the absolute path for your script. ie.

lua_load /home/runny6play/conky_outline.lua

Offline

#3 2012-03-26 21:47:30

runny6play
Member
Registered: 2012-02-18
Posts: 85

Re: conky-lua problem

I tried it. It had no effect. also I changed lua_draw_hook_post main to lua_draw_hook_post conky_main
and this is what i got. though i think its just annother error for the setting i just changed because its incorrect.

Conky: llua_load: /home/alec/conky_outline.lua:11: module 'cario' not found:
	no field package.preload['cario']
	no file './cario.lua'
	no file '/usr/share/lua/5.1/cario.lua'
	no file '/usr/share/lua/5.1/cario/init.lua'
	no file '/usr/lib/lua/5.1/cario.lua'
	no file '/usr/lib/lua/5.1/cario/init.lua'
	no file '/usr/lib/conky/libcario.so'
	no file './cario.so'
	no file '/usr/lib/lua/5.1/cario.so'
	no file '/usr/lib/lua/5.1/loadall.so'
Conky: desktop window (15d) is root window
Conky: window type - desktop
Conky: drawing to created window (0x1200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value

Offline

#4 2012-03-26 23:20:05

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,682

Re: conky-lua problem

Are you running a version of conky with the lua bindings enabled?
https://aur.archlinux.org/packages.php?ID=31589

Offline

#5 2012-03-26 23:30:25

runny6play
Member
Registered: 2012-02-18
Posts: 85

Re: conky-lua problem

im running the conky-lua-nv package from the AUR and have seen it run a lua based conky set up before

Conky 1.8.1 compiled Wed Mar 21 19:04:30 EDT 2012 for Linux 3.3.0-1-ARCH (x86_64)

Compiled in features:

System config file: /etc/conky/conky.conf
Package library path: /usr/lib/conky

 X11:
  * Xdamage extension
  * XDBE (double buffer extension)
  * Xft
  * ARGB visual

 Music detection:
  * MPD
  * MOC

 General:
  * math
  * hddtemp
  * portmon
  * Curl
  * RSS
  * wireless
  * support for IBM/Lenovo notebooks
  * nvidia
  * config-output
  * Imlib2
  * apcupsd
  * iostats
  * ncurses
  * Lua

  Lua bindings:
   * Cairo
   * Imlib2

Last edited by runny6play (2012-03-26 23:32:00)

Offline

#6 2012-03-27 00:12:50

KingX
Member
From: CA
Registered: 2010-03-24
Posts: 324

Re: conky-lua problem

runny6play wrote:

I tried it. It had no effect. also I changed lua_draw_hook_post main to lua_draw_hook_post conky_main
and this is what i got. though i think its just annother error for the setting i just changed because its incorrect.

Conky: llua_load: /home/alec/conky_outline.lua:11: module 'cario' not found:
	no field package.preload['cario']
	no file './cario.lua'
	no file '/usr/share/lua/5.1/cario.lua'
	no file '/usr/share/lua/5.1/cario/init.lua'
	no file '/usr/lib/lua/5.1/cario.lua'
	no file '/usr/lib/lua/5.1/cario/init.lua'
	no file '/usr/lib/conky/libcario.so'
	no file './cario.so'
	no file '/usr/lib/lua/5.1/cario.so'
	no file '/usr/lib/lua/5.1/loadall.so'
Conky: desktop window (15d) is root window
Conky: window type - desktop
Conky: drawing to created window (0x1200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_main execution failed: attempt to call a nil value

Shouldn't that be "Cairo" and not "Cario"?

Offline

#7 2012-03-27 18:52:30

runny6play
Member
Registered: 2012-02-18
Posts: 85

Re: conky-lua problem

thank you guys. KingX that solved it. Thank you

Offline

Board footer

Powered by FluxBB