Fix Lua Wiki export, add more notes to fill in some of the holes

frameadvance loop is documented now so for the first time you can write a script
without reading someone else's :O imagine that
This commit is contained in:
YoshiRulz 2022-08-05 11:22:06 +10:00
parent 7bb4b28093
commit 1452f831af
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 32 additions and 4 deletions

View File

@ -12,12 +12,14 @@ namespace BizHawk.Client.Common
{
var sb = new StringBuilder();
sb.AppendLine("[module:ListParents]")
.AppendLine()
.AppendLine("__This is an autogenerated page, do not edit.__ (To update, open the function list dialog on a Debug build and click the wiki button.)")
sb.AppendLine("__This is an autogenerated page, do not edit.__ (To update, open the function list dialog on a Debug build and click the wiki button.)")
.AppendLine()
.AppendLine("This page documents the the behavior and parameters of Lua functions available for the [BizHawk] emulator. The function list is also available from within EmuHawk. From the Lua Console, click Help > Lua Functions List or press F1.")
.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("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()
.AppendLine(@"__Types and notation__
* [[]] (brackets)
** Brackets around a parameter indicate that the parameter is optional. Optional parameters have an equals sign followed by the value that will be used if no value is supplied.
@ -42,7 +44,33 @@ namespace BizHawk.Client.Common
* table
** A standard Lua table
* something else
** check the .NET documentation on MSDN
** check the .NET documentation on MSDN")
.AppendLine()
.AppendLine(@"__Common parameter meanings__
* {{ulong addr}}/{{long addr}}/{{uint addr}}/{{int addr}} in memory functions
** Relative to the specified domain (or the ""current"" domain, see above).
** Some memory events allow {{nil}} for the address. That will hook on all addresses.
* {{string domain}} in memory functions
** The name of a memory domain. The list of valid domains is returned by {{memory.getmemorydomainlist}}, or can be seen in various tools such as the Hex Editor.
** If {{domain}} is optional (i.e. the function has {{nil}} as the default argument) and you pass {{nil}} or omit the argument, the ""current"" domain is used. This can be set/gotten with {{memory.usememorydomain}}/{{memory.getcurrentmemorydomain}}.
* {{string scope}} in memory functions
** The name of a scope. The list of valid scopes is returned by {{event.availableScopes}}.
* {{int frame}} in {{movie}}/{{tastudio}} functions and others
** Frame index i.e. the number of VBlanks that have been seen. While many EmuHawk features use this concept, note that most take effect ''after'' a certain frame, but some, such as memory freezes and polling/inputs, take effect ''during'' a frame.
* {{int? controller}}/{{int? player}} in (virtual) input functions
** Player index, as seen in {{Config}} > {{Controllers...}} (starts at 1).
** If you pass {{nil}} or omit the argument, this will either indicate all players, or ""no player"" i.e. buttons on the Console. See the relevant function's documentation.
* {{luacolor line}}/{{luacolor background}} in drawing functions
** {{line}} is the ""stroke"" or ""outline"" color, {{background}} is the ""fill"" color. Both can have transparency.
* {{string surfacename}} in {{gui}} drawing functions
** Either {{""emucore""}} or {{""client""}}.
** If you pass {{nil}} or omit the argument, the ""current"" surface is used. This can be set with {{gui.use_surface}}.
* other {{string}} parameters in drawing functions
** See the relevant function's documentation.
* {{int handle}} in forms functions
** These handles are returned by {{forms.newform}} and the various control creation functions such as {{forms.checkbox}}.
* {{string guid}}/{{string name}} in event functions
** The ''name'' of a callback is an optional parameter in all the event subscription functions. The ''ID'' of a callback is what's returned by the subscription function. Multiple callbacks can share the same name, but IDs are unique.
");
foreach (var library in this.Select(lf => (Name: lf.Library, Description: lf.LibraryDescription))