[vlc-commits] commit: lua: also implement timer:getoverrun() ( Rémi Duraffort )
git at videolan.org
git at videolan.org
Mon Sep 13 19:46:50 CEST 2010
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Sep 13 19:46:31 2010 +0200| [519fe4ca46c9c415856835cbfe5d6b8710ca7203] | committer: Rémi Duraffort
lua: also implement timer:getoverrun()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=519fe4ca46c9c415856835cbfe5d6b8710ca7203
---
modules/misc/lua/libs/misc.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/modules/misc/lua/libs/misc.c b/modules/misc/lua/libs/misc.c
index 2d7bbc9..96f260f 100644
--- a/modules/misc/lua/libs/misc.c
+++ b/modules/misc/lua/libs/misc.c
@@ -248,10 +248,12 @@ static int vlclua_action_id( lua_State *L )
* Timer functions
*****************************************************************************/
static int vlclua_timer_schedule( lua_State *L );
+static int vlclua_timer_getoverrun( lua_State *L);
static const luaL_Reg vlclua_timer_reg[] = {
- { "schedule", vlclua_timer_schedule },
- { NULL, NULL }
+ { "schedule", vlclua_timer_schedule },
+ { "getoverrun", vlclua_timer_getoverrun },
+ { NULL, NULL }
};
typedef struct
@@ -275,6 +277,16 @@ static int vlclua_timer_schedule( lua_State *L )
return 0;
}
+static int vlclua_timer_getoverrun( lua_State *L )
+{
+ vlclua_timer_t **pp_timer = (vlclua_timer_t**)luaL_checkudata(L, 1, "timer" );
+ if( !pp_timer || !*pp_timer )
+ luaL_error( L, "Can't get pointer to timer" );
+
+ lua_pushinteger( L, vlc_timer_getoverrun( (*pp_timer)->timer ) );
+ return 1;
+}
+
static void vlclua_timer_callback( void *data )
{
vlclua_timer_t *p_timer = (vlclua_timer_t*)data;
More information about the vlc-commits
mailing list