Add `branchIndex` parameter to `tastudio.getmarker`

This commit is contained in:
YoshiRulz 2025-05-28 00:40:28 +10:00
parent f4d98293d8
commit ff04b85199
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 7 additions and 3 deletions

View File

@ -444,12 +444,16 @@ namespace BizHawk.Client.EmuHawk
}
[LuaMethodExample("local sttasget = tastudio.getmarker( 500 );")]
[LuaMethod("getmarker", "returns the marker text at the given frame, or an empty string if there is no marker for the given frame")]
public string GetMarker(int frame)
[LuaMethod(
name: "getmarker",
description: "Returns the label of the marker on the given frame."
+ " If that frame doesn't have a marker (or TAStudio isn't running), returns an empty string."
+ " If branchIndex is specified, searches the markers in that branch instead.")]
public string GetMarker(int frame, int? branchIndex = null)
{
if (Engaged())
{
var marker = Tastudio.CurrentTasMovie.Markers.Get(frame);
var marker = MarkerListForBranch(branchIndex).Get(frame);
if (marker != null)
{
return marker.Message;