From f3d8388dfe5ce736831018b0acb64408a4bf0644 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 4 Aug 2015 18:22:22 -0400 Subject: [PATCH] Lua - implement movie.getheader() --- .../lua/EmuLuaLibrary.Movie.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs index d3e863df51..f09bb346a0 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs @@ -218,5 +218,23 @@ namespace BizHawk.Client.Common return 0.0; } + + [LuaMethodAttributes( + "getheader", + "If a movie is active, will return the movie header as a lua table" + )] + public LuaTable GetHeader() + { + var luaTable = Lua.NewTable(); + if (Global.MovieSession.Movie.IsActive) + { + foreach (var kvp in Global.MovieSession.Movie.HeaderEntries) + { + luaTable[kvp.Key] = kvp.Value; + } + } + + return luaTable; + } } }