[vlc-commits] commit: lua_variables: implement var_IncInteger and var_DecInteger ( Rémi Duraffort )

git at videolan.org git at videolan.org
Tue Nov 2 15:24:21 CET 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Nov  2 15:19:00 2010 +0100| [7046783c69d5c97d4154f9885b6f515a27d07715] | committer: Rémi Duraffort 

lua_variables: implement var_IncInteger and var_DecInteger

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7046783c69d5c97d4154f9885b6f515a27d07715
---

 modules/misc/lua/libs/variables.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/libs/variables.c b/modules/misc/lua/libs/variables.c
index f0b1cbf..a365b89 100644
--- a/modules/misc/lua/libs/variables.c
+++ b/modules/misc/lua/libs/variables.c
@@ -542,6 +542,26 @@ static int vlclua_trigger_callback( lua_State *L )
     return vlclua_push_ret( L, var_TriggerCallback( *pp_obj, psz_var ) );
 }
 
+static int vlclua_inc_integer( lua_State *L )
+{
+    vlc_object_t **pp_obj = luaL_checkudata( L, 1, "vlc_object" );
+    const char *psz_var = luaL_checkstring( L, 2 );
+    int64_t i_val = var_IncInteger( *pp_obj, psz_var );
+
+    lua_pushinteger( L, i_val );
+    return 1;
+}
+
+static int vlclua_dec_integer( lua_State *L )
+{
+    vlc_object_t **pp_obj = luaL_checkudata( L, 1, "vlc_object" );
+    const char *psz_var = luaL_checkstring( L, 2 );
+    int64_t i_val = var_DecInteger( *pp_obj, psz_var );
+
+    lua_pushinteger( L, i_val );
+    return 1;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -555,6 +575,8 @@ static const luaL_Reg vlclua_var_reg[] = {
     { "trigger_callback", vlclua_trigger_callback },
     { "command", vlclua_command },
     { "libvlc_command", vlclua_libvlc_command },
+    { "inc_integer", vlclua_inc_integer },
+    { "dec_integer", vlclua_dec_integer },
     { NULL, NULL }
 };
 



More information about the vlc-commits mailing list