BizHawk icon indicating copy to clipboard operation
BizHawk copied to clipboard

MoonSharp / the future of Lua

Open YoshiRulz opened this issue 3 years ago • 4 comments

(~~going to flesh this out more later~~ the can has been kicked down the road now that Lua works under Mono)

(see existing discussion in https://github.com/TASVideos/BizHawk/issues/971#issuecomment-549660627, #1415, #1422, and #1491, and also in IRC logs if you have them)

options to choose from:

  • Lua
    • (status quo) NLua w/ same API surface
    • MoonSharp w/ same API surface (fully managed, but it's still only up to Lua 5.2)
    • Pluto (fork of Lua 5.4, probably no C# bindings)
    • Roblox' Luau w/ same API surface (fork of Lua 5.1 with more or fewer features compared to Lua 5.4, notably no integers or stdlib io, also I doubt there are C# bindings)
    • some form of Lua w/ new API surface
  • C#
    • Roslyn embedding is heavy but functional, case study: Space Engineers
  • I'll make my own C#, with blackjack and hookers!
    • I've considered forking the Roslyn C# compiler to create a new .NET language, but C# is becoming increasingly like my vision with every update. So see above re: embedded C#.
  • Kotlin
    • blocked by either: 1. Xamarin merger finally adding JVM compat to .NET 8+ (and then us moving to .NET 8+), or
    • 2. Kotlin compiler getting an MSIL target (unlikely)
  • Python (see #1243)
  • IronRuby (dead)
  • Rune
    • blocked by unfinished C FFI (only Rust hosts can spawn a Rune VM for now)

YoshiRulz avatar Jul 31 '20 07:07 YoshiRulz

(reserved because I can imagine this thread getting real long)

YoshiRulz avatar Jul 31 '20 08:07 YoshiRulz

edit 2022-05-07: KeraLua is another .NET Standard 2.0 library, but supports Lua 5.4 features, unlike MoonSharp.

To clarify here, KeraLua is the new Lua "backend" for NLua. Our NLua is still when they used KopiLua, and we only are able to use native Lua with a hacky switcharoo to give it our LuaInterface instead of KopiLua.

It would probably be easiest (and best in terms of lua functionality) overall to just update our NLua to upstream and delete our LuaInterface. I tried a bit here: https://github.com/CasualPokePlayer/BizHawk/tree/moonshot and it seems to execute commands within the console without completely crashing, so it doesn't seem so bad to do.

CasualPokePlayer avatar Aug 18 '22 04:08 CasualPokePlayer

https://github.com/CasualPokePlayer/BizHawk/commit/c41096ac01bc88040b286ceb483e2860dc9fdb7b seems to work on Linux

YoshiRulz avatar Aug 18 '22 11:08 YoshiRulz