1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2007-2008 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea at videolan tod org>
8 * Pierre d'Herbemont <pdherbemont # videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
36 #include <vlc_common.h>
37 #include <vlc_plugin.h>
43 /*****************************************************************************
44 * Messaging facilities
45 *****************************************************************************/
46 static int vlclua_msg_dbg( lua_State *L )
48 int i_top = lua_gettop( L );
49 vlc_object_t *p_this = vlclua_get_this( L );
51 for( i = 1; i <= i_top; i++ )
52 msg_Dbg( p_this, "%s", luaL_checkstring( L, i ) );
56 static int vlclua_msg_warn( lua_State *L )
58 int i_top = lua_gettop( L );
59 vlc_object_t *p_this = vlclua_get_this( L );
61 for( i = 1; i <= i_top; i++ )
62 msg_Warn( p_this, "%s", luaL_checkstring( L, i ) );
66 static int vlclua_msg_err( lua_State *L )
68 int i_top = lua_gettop( L );
69 vlc_object_t *p_this = vlclua_get_this( L );
71 for( i = 1; i <= i_top; i++ )
72 msg_Err( p_this, "%s", luaL_checkstring( L, i ) );
76 static int vlclua_msg_info( lua_State *L )
78 int i_top = lua_gettop( L );
79 vlc_object_t *p_this = vlclua_get_this( L );
81 for( i = 1; i <= i_top; i++ )
82 msg_Info( p_this, "%s", luaL_checkstring( L, i ) );
86 /*****************************************************************************
88 *****************************************************************************/
89 static const luaL_Reg vlclua_msg_reg[] = {
90 { "dbg", vlclua_msg_dbg },
91 { "warn", vlclua_msg_warn },
92 { "err", vlclua_msg_err },
93 { "info", vlclua_msg_info },
97 void luaopen_msg( lua_State *L )
100 luaL_register( L, NULL, vlclua_msg_reg );
101 lua_setfield( L, -2, "msg" );