1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

Don't place conky_ in front of lua functionnames if it's already there

This commit is contained in:
Nikolas Garofil 2009-07-25 12:03:09 +02:00
parent 7ce38ecf09
commit febc5306e2
3 changed files with 22 additions and 5 deletions

View File

@ -1797,7 +1797,9 @@
</term>
<listitem>Executes a Lua function with given parameters,
then prints the returned string. See also 'lua_load' on how
to load scripts.
to load scripts. Conky puts 'conky_' in front of function_name
to prevent accidental calls to the wrong function unless you
put you place 'conky_' in front of it yourself.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -1811,6 +1813,9 @@
<listitem>Executes a Lua function with given parameters and
draws a bar. Expects result value to be an integer between
0 and 100. See also 'lua_load' on how to load scripts.
Conky puts 'conky_' in front of function_name to prevent
accidental calls to the wrong function unless you
put you place 'conky_' in front of it yourself.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -1824,7 +1829,9 @@
<listitem>Executes a Lua function with given parameters and
draws a gauge. Expects result value to be an integer
between 0 and 100. See also 'lua_load' on how to load
scripts.
scripts. Conky puts 'conky_' in front of function_name
to prevent accidental calls to the wrong function unless you
put you place 'conky_' in front of it yourself.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -1841,7 +1848,9 @@
load scripts. Takes the switch '-t' to use a temperature
gradient, which makes the gradient values change depending
on the amplitude of a particular graph value (try it and
see).
see). Conky puts 'conky_' in front of function_name
to prevent accidental calls to the wrong function unless you
put you place 'conky_' in front of it yourself.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -1854,7 +1863,9 @@
<listitem>Executes a Lua function with given parameters as
per $lua, then parses and prints the result value as per
the syntax for Conky's TEXT section. See also 'lua_load' on
how to load scripts.
how to load scripts. Conky puts 'conky_' in front of function_name
to prevent accidental calls to the wrong function unless you
put you place 'conky_' in front of it yourself.
<para /></listitem>
</varlistentry>
<varlistentry>

View File

@ -136,7 +136,11 @@ char *llua_do_call(const char *string, int retc)
}
/* call only conky_ prefixed functions */
snprintf(func, 64, "conky_%s", ptr);
if(strncmp(ptr, LUAPREFIX, strlen(LUAPREFIX)) == 0) {
snprintf(func, 64, "%s", ptr);
}else{
snprintf(func, 64, "%s%s", LUAPREFIX, ptr);
}
/* push the function name to stack */
lua_getglobal(lua_L, func);

View File

@ -32,6 +32,8 @@
#include "x11.h"
#endif /* X11 */
#define LUAPREFIX "conky_"
/* load a lua script */
void llua_load(const char *script);
/* call a function with args, and return a string from it (must be free'd) */