TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.15k stars 380 forks source link

Lua Functions: On Copy of a Row Remove C Style Comment / Maybe Change Parameter Name in Ex #2516

Open ShinobiWannabe opened 3 years ago

ShinobiWannabe commented 3 years ago

In the Lua Functions grid if you right-click and copy the row to get a quick example it is copied in a format that is not completely compatible with Lua. "//" should be replaced with "--" otherwise a user gets NLua.Exceptions.LuaScriptException: [string "main"]:51: unexpected symbol near '/'.

A couple other things I have to question. The "Frame name" is the event name if you want to use that function name to remove, but the name should most likely be "Event Name" in these examples. local "steveonm" seems an odd variable name as well to me for something would contain a GUID for an event in case you wanted to identify it later such as for removal later with the event unregisterbyid.

image

//event.onmemoryexecute(nluafunc luaf, uint address, [string name = null], [string scope = null]) local steveonm = event.onmemoryexecute( function() console.log( "Fires after the given address is executed by the core" ); end , 0x200, "Frame name", "System Bus" );

--another example of a copy below

//event.onsavestate(nluafunc luaf, [string name = null]) local steveons = event.onsavestate( function() console.log( "Fires after a state is saved" ); end , "Frame name" );

nattthebear commented 3 years ago

:shrug:

sb.Append($"//{itm.Library}.{itm.Name}{itm.ParameterList}"); // comment style not an accident: the 'declaration' is not legal lua, so use of -- to comment it shouldn't suggest it. right?