Fix NRE in `movie.getinput`

This commit is contained in:
James Groom 2024-05-06 01:20:58 +10:00 committed by GitHub
parent 98fc076c5b
commit 348866b75a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -30,7 +30,9 @@ namespace BizHawk.Client.Common
[LuaMethodExample("local nlmovget = movie.getinput( 500 );")]
[LuaMethod("getinput", "Returns a table of buttons pressed on a given frame of the loaded movie")]
public LuaTable GetInput(int frame, int? controller = null)
=> _th.DictToTable(APIs.Movie.GetInput(frame, controller));
=> APIs.Movie.GetInput(frame, controller) is IReadOnlyDictionary<string, object> dict
? _th.DictToTable(dict)
: null;
[LuaMethodExample("local stmovget = movie.getinputasmnemonic( 500 );")]
[LuaMethod("getinputasmnemonic", "Returns the input of a given frame of the loaded movie in a raw inputlog string")]