title: lua error: attempt to call a nil value (field 'getn')
body: <p>I have the following lua code snippet (that uses cairo)</p>
  
  <pre><code> cairo_set_source_rgba(cr, COLOR_FONT_R, COLOR_FONT_G, COLOR_FONT_B, 1)
    cairo_set_font_size(cr, 0.011 * WINDOW_HEIGHT)
    local ps_str = conky_parse("${exec ps -Ao comm,pcpu,%mem  --sort=-pcpu | head -n 15}")
    local processes = {}
    for line in string.gmatch(ps_str, '([^\n]+)') do
      table.insert(processes, line)
    end
    for line = 1,table.getn(processes) do
      cairo_move_to(cr, 0.213 * WINDOW_WIDTH, 0.443 * WINDOW_HEIGHT + line * 0.014 * WINDOW_HEIGHT)
      cairo_show_text(cr, processes[line])
    end
    cairo_stroke(cr)
  </code></pre>
  
  <p>However, when I run it through conky, I get the following error (this is in the line, 5 lines from the end).</p>
  
  <p>I get the error: attempt to call a nil value (field 'getn')</p>
  
  <p>I have tried a few things suggested here, but I am not sure how to fix this so was wondering if there is an easy fix. </p>
  
  <p>The suggested solution in the comments works beautifully for the above but not for the following:</p>
  
  <pre><code>function conky_geo_dotspiral(cx_str, cy_str, ...)
    local cx = conky_to_num(cx_str)
    local cy = conky_to_num(cy_str)
    local arms = math.ceil(24 / table.getn(arg)) * table.getn(arg)
    local rows = 10
    local radius0, radius1 = 50, 140
    local dotradius = 4
    for i,v_str in ipairs(arg) do
      v = conky_to_num(conky_parse(v_str))
      for j = i-1, arms - 1, table.getn(arg) do
        local p = j / arms
        for k = 0, v / rows  do
          local dx = cx + (radius0 + (radius1-radius0) * k/rows) * math.cos(p * 2*math.pi + k * math.pi/arms)
          local dy = cy + (radius0 + (radius1-radius0) * k/rows) * math.sin(p * 2*math.pi + k * math.pi/arms)
          cairo_arc (cr, dx, dy, dotradius, 0, 2 * math.pi)
          cairo_fill(cr)
        end
      end
    end
  end
  </code></pre>
  
  <p>I get the error: </p>
  
  <p>attempt to call a nil value (field 'getn')</p>
  
  <p>I tried replacing table.getn(arg) with #arg but still get the error.</p>
  
  <pre><code>conky: llua_do_call: function conky_geo_dotspiral execution failed: conky_geometry.lua:155: attempt to get length of a nil value (global 'arg')
  </code></pre>