]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/libs/misc.c
Experimental lua gettext support.
[vlc] / modules / misc / lua / libs / misc.c
index e5a1f02aa175fc1681ca86b9e56fe784c4348ae1..09a8e272701b7f9e91fb68c141b15f6c8b938347 100644 (file)
@@ -39,6 +39,7 @@
 #include <vlc_charset.h>
 #include <vlc_aout.h>
 #include <vlc_interface.h>
+#include <vlc_keys.h>
 
 #include <lua.h>        /* Low level lua C API */
 #include <lauxlib.h>    /* Higher level C API */
@@ -181,9 +182,10 @@ static int vlclua_lock_and_wait( lua_State *L )
     intf_sys_t *p_sys = p_intf->p_sys;
 
     vlc_mutex_lock( &p_sys->lock );
+    mutex_cleanup_push( &p_sys->lock );
     while( !p_sys->exiting )
         vlc_cond_wait( &p_sys->wait, &p_sys->lock );
-    vlc_mutex_unlock( &p_sys->lock );
+    vlc_cleanup_pop();
     lua_pushboolean( L, 1 );
     return 1;
 }
@@ -208,6 +210,15 @@ static int vlclua_intf_should_die( lua_State *L )
     return 1;
 }
 
+static int vlclua_action_id( lua_State *L )
+{
+    vlc_key_t i_key = vlc_GetActionId( luaL_checkstring( L, 1 ) );
+    if (i_key == 0)
+        return 0;
+    lua_pushnumber( L, i_key );
+    return 1;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -223,6 +234,8 @@ static const luaL_Reg vlclua_misc_reg[] = {
     { "cachedir", vlclua_cachedir },
     { "datadir_list", vlclua_datadir_list },
 
+    { "action_id", vlclua_action_id },
+
     { "mdate", vlclua_mdate },
     { "mwait", vlclua_mwait },