a193f513f465df8e18ccd2de8da46b12e7c47273
[collectd.git] / src / lua_exports.c
1 /**
2  * collectd - src/lua_exports.c
3  * Copyright (C) 2010       Julien Ammous
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation; only version 2.1 of the License is
8  * applicable.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * Authors:
20  *   Julien Ammous
21  **/
22
23
24 /* this file contains the functions exported to lua scripts */
25
26 /* log_info(string) */
27 static int log_info(lua_State *l)
28 {
29   const char *message = lua_tostring(l, 1);
30   INFO("%s", message);
31   // return the number of values pushed on stack
32   return 0;
33 }
34
35
36 static int register_exported_functions(lua_State *l){
37   lua_register(l, "log_info", log_info);
38   return 0;
39 }
40