From 12479cbc25286958c0ff86a58ca81d0fdcd92a35 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 4 Aug 2015 18:33:22 -0400 Subject: [PATCH] lua implement movie.getcomments() and movie.getsubtitles() --- .../lua/EmuLuaLibrary.Movie.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs index f09bb346a0..17e84bcfa1 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs @@ -236,5 +236,41 @@ namespace BizHawk.Client.Common return luaTable; } + + [LuaMethodAttributes( + "getcomments", + "If a movie is active, will return the movie comments as a lua table" + )] + public LuaTable GetComments() + { + var luaTable = Lua.NewTable(); + if (Global.MovieSession.Movie.IsActive) + { + for (int i = 0; i < Global.MovieSession.Movie.Comments.Count; i++) + { + luaTable[i] = Global.MovieSession.Movie.Comments[i]; + } + } + + return luaTable; + } + + [LuaMethodAttributes( + "getsubtitles", + "If a movie is active, will return the movie subtitles as a lua table" + )] + public LuaTable GetSubtitles() + { + var luaTable = Lua.NewTable(); + if (Global.MovieSession.Movie.IsActive) + { + for (int i = 0; i < Global.MovieSession.Movie.Subtitles.Count; i++) + { + luaTable[i] = Global.MovieSession.Movie.Subtitles[i].ToString(); + } + } + + return luaTable; + } } }