]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/vlc.h
lua: factorize the right way.
[vlc] / modules / misc / lua / vlc.h
index ff3d4da6eb58a97f5772fb04725e81e0880a4c32..d3187e76beb4ab2b32959e4a4668fde3a8cbc20a 100644 (file)
@@ -91,6 +91,13 @@ static inline const char *luaL_nilorcheckstring( lua_State *L, int narg )
     return luaL_checkstring( L, narg );
 }
 
+static inline char *luaL_strdupornull( lua_State *L, int narg )
+{
+    if( lua_isstring( L, narg ) )
+        return strdup( luaL_checkstring( L, narg ) );
+    return NULL;
+}
+
 void vlclua_set_this( lua_State *, vlc_object_t * );
 #define vlclua_set_this(a, b) vlclua_set_this(a, VLC_OBJECT(b))
 vlc_object_t * vlclua_get_this( lua_State * );