title: How to implement a basic Lua function in Conky?
body: <p>I am trying to add a function to my Conky which prints the length of a string for debug purposes. The code, inside a file called <code>test.lua</code>, is pretty trivial:</p>
  
  <pre><code>function test(word)
  return string.len(word)
  end
  </code></pre>
  
  <p>...and I load it like this. In my <code>conky.config</code> section I have:</p>
  
  <pre><code>lua_load = '/home/xvlaze/test.lua',
  lua_draw_hook_pre = 'test'
  </code></pre>
  
  <p>...in the <code>conky.text</code> section I have:</p>
  
  <pre><code>${lua test "fooo"}
  </code></pre>
  
  <p>...where <code>test</code> is the name of the function and <code>fooo</code> the string to test.</p>
  
  <p>The expected result should be a printed 4 in Conky, but instead of that I get: </p>
  
  <pre><code>conky: llua_do_call: function conky_test execution failed: /home/xvlaze/test.lua:2: attempt to index a nil value (local 'string')
  conky: llua_getstring: function conky_test didn't return a string, result discarded
  </code></pre>
  
  <p>I have browsed through the <a href="https://github.com/brndnmtthws/conky/wiki" rel="nofollow noreferrer">documentation</a>, but I can't find anything. Does anybody know where the failure is?</p>