Additional corrections to newly-added Lua documentation

fixes 49cd836e1, c7781d1c1
This commit is contained in:
YoshiRulz 2022-12-11 13:29:14 +10:00
parent c7781d1c17
commit f101cb5a54
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 5 additions and 5 deletions

View File

@ -18,9 +18,9 @@ namespace BizHawk.Client.Common
.AppendLine()
.AppendLine("As you might expect, Lua scripts execute top to bottom once, so to run something every frame you'll need to end the script with an infinite loop (or you could set a callback on one of the events instead). Make sure to call {{emu.frameadvance}} or {{emu.yield}} in the loop or your script will hang EmuHawk and then crash!")
.AppendLine()
.AppendLine("Lua supports integer arithmetic starting with BizHawk 2.9. Note {{~}} is both bitwise NOT and XOR. Some of the {{bit}} helper functions remain, but you should try to avoid them if you need performance (or [https://github.com/TASEmulators/BizHawk-ExternalTools/wiki|switch to .NET]).")
.AppendLine("Lua supports integer arithmetic starting with BizHawk 2.9. Note {{~}} is both bitwise NOT and XOR. Some of the {{bit}} helper functions remain, but you should try to avoid them if you need performance (or [https://github.com/TASEmulators/BizHawk-ExternalTools/wiki|switch to .NET]). If you're getting overwhelmed with deprecation warnings while trying to migrate a script, add this one-liner at the top: {{bit = (require \"migration_helpers\").EmuHawk_pre_2_9_bit();}}")
.AppendLine()
.AppendLine("FCEUX users: While this API surface may look similar, even functions with the same name may take different arguments, or behave differently in a way that isn't immediately obvious.")
.AppendLine("FCEUX users: While this API surface may look similar, even functions with the same name may take different arguments, or behave differently in a way that isn't immediately obvious. (TODO: create a migration helper function for FCEUX)")
.AppendLine()
.AppendLine(@"__Types and notation__
* [[]] (brackets)

View File

@ -45,7 +45,7 @@ namespace BizHawk.Client.Common
[LuaMethod("bxor", "Bitwise XOR of 'val' against 'amt'")]
public uint Bxor(uint val, uint amt)
{
Log("Using bit.bxor is deprecated, use the a ~ b operator instead.");
Log("Using bit.bxor is deprecated, use the a ~ b operator instead (not a typo, ^ is pow).");
return val ^ amt;
}

View File

@ -44,7 +44,7 @@ namespace BizHawk.Client.Common
Log($"{scope} is not an available scope for {Emulator.Attributes().CoreName}");
}
[LuaMethod("can_use_callback_params", "Returns whether EmuHawk will pass arguments to callbacks. This version passes arguments to \"memory\" callbacks (RAM/ROM/bus R/W), so this function will return true for that input. (It returns false for any other input.) This tells you whether hacks for older versions w/o parameter support are necessary.")]
[LuaMethod("can_use_callback_params", "Returns whether EmuHawk will pass arguments to callbacks. The current version passes arguments to \"memory\" callbacks (RAM/ROM/bus R/W), so this function will return true for that input. (It returns false for any other input.) This tells you whether it's necessary to enable workarounds/hacks because a script is running in a version without parameter support.")]
[LuaMethodExample("local mem_callback = event.can_use_callback_params(\"memory\") and mem_callback or mem_callback_pre_29;")]
public bool CanUseCallbackParams(string subset = null)
=> subset is "memory";

View File

@ -813,7 +813,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethodExample("forms.drawImageRegion( 334, \"C:\\image.bmp\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
[LuaMethod(
"drawImageRegion",
"Draws a region of the given image file at the given location on the canvas, and optionally resizes it before drawing. On the TASVideos Wiki, consult this diagram to see its usage: [https://user-images.githubusercontent.com/13409956/198868522-55dc1e5f-ae67-4ebb-a75f-558656cb4468.png|alt=Diagram showing how to use forms.drawImageRegion]")]
"Draws a region of the given image file at the given location on the canvas, and optionally resizes it before drawing. Consult this diagram to see its usage (renders embedded on the TASVideos Wiki): [https://user-images.githubusercontent.com/13409956/198868522-55dc1e5f-ae67-4ebb-a75f-558656cb4468.png|alt=Diagram showing how to use forms.drawImageRegion]")]
public void DrawImageRegion(
long componentHandle,
string path,