Skip to content

Lua tastudio branches#4681

Draft
YoshiRulz wants to merge 5 commits into
masterfrom
lua-tastudio-branches
Draft

Lua tastudio branches#4681
YoshiRulz wants to merge 5 commits into
masterfrom
lua-tastudio-branches

Conversation

@YoshiRulz

Copy link
Copy Markdown
Member

dev build for branch | TASEmulators:lua-tastudio-branches

resolves #4073

@YoshiRulz YoshiRulz requested a review from adelikat April 15, 2026 01:02
@YoshiRulz YoshiRulz added Tool: TAStudio re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) labels Apr 15, 2026
Comment thread src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs Outdated
@SuuperW

This comment was marked as resolved.

@YoshiRulz YoshiRulz force-pushed the lua-tastudio-branches branch from f667900 to 58e3a96 Compare April 20, 2026 11:38

@SuuperW SuuperW left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and there might be stuff to update regarding the recent addition of LuaCATS documentation, but I haven't looked at that)

Comment thread src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs Outdated
Comment thread src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs Outdated
var index = Tastudio.CurrentTasMovie.Branches.Count - 1;
var branch = Tastudio.CurrentTasMovie.Branches[index];
branch.UserText = text;
Tastudio.BranchSavedCallback?.Invoke(index);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer changing the Branch method to return the instance, instead of grabbing it by index here.

Also, I think the Branch method should handle calling BranchSavedCallback. It looks like from reading related code that the callback isn't called if you branch with the context menu item, so you'd be fixing that too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other existing callsites use the index.

The callback can't be moved to the end of Branch because of this:

Branch();
EditBranchTextPopUp(Branches.Current);
Tastudio.BranchSavedCallback?.Invoke(Branches.Count - 1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other existing callsites use the index.

So? They don't grab the branch, and updating Branch to return the branch will not require changing any existing uses.

The callback can't be moved to the end of Branch because of this:

Because of what? The branch not having text at the end of Branch? It should be easy enough to place a call to EditBranchTextPopUp inside Branch depending on a parameter.

@YoshiRulz YoshiRulz force-pushed the lua-tastudio-branches branch from 58e3a96 to dc7c820 Compare April 27, 2026 06:41
@SuuperW

SuuperW commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Is there a reason you decided to keep "UUID" in the error message?

@YoshiRulz

Copy link
Copy Markdown
Member Author

if (!Guid.TryParseExact(id, format: "D", out var parsed))
{
Log($"[tastudio.{callerFunctionName}] not a valid UUID: {id}");

That is an accurate description of the failure.

@SuuperW

SuuperW commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

But at a level of detail most users will not understand. You changed the "UUID" in the Lua documentation to just "ID", so I thought this one might be an oversight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) Tool: TAStudio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow saving new branches via Lua?

2 participants