]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/libs/stream.c
Change vlc.stream() and vlc.memory_stream() error reporting to behave like lua's...
[vlc] / modules / misc / lua / libs / stream.c
index 4a940586e33da814b56887652099b59282a3de8a..4dcae620646de25394b1cc71ab42fcdbef2c194a 100644 (file)
@@ -62,7 +62,11 @@ static const luaL_Reg vlclua_stream_reg[] = {
 static int vlclua_stream_new_inner( lua_State *L, stream_t *p_stream )
 {
     if( !p_stream )
-        return luaL_error( L, "Error when opening stream" );
+    {
+        lua_pushnil( L );
+        lua_pushliteral( L, "Error when opening stream" );
+        return 2;
+    }
 
     stream_t **pp_stream = lua_newuserdata( L, sizeof( stream_t * ) );
     *pp_stream = p_stream;