Fiu | Complete Luau bytecode interpreter

Pronounced like “Phew”. This interpreter aims to provide a decently fast and reliable way of executing Luau bytecode without the use of loadstring.

After two years of work the interpreter finally exits pre-release state. Fiu now comes in a completely configurable state with proper emulation for more niche capabilities of the Luau VM such as callbacks. Native namecalling is also available through the namecallHandler setting. See the full list of changes at the github commit.

Github: GitHub - rce-incorporated/Fiu: Luau bytecode interpreter for Luau
README and documentation: Fiu/README.md at main · rce-incorporated/Fiu · GitHub
Examples: Fiu/examples at main · rce-incorporated/Fiu · GitHub
Download: Releases · rce-incorporated/Fiu · GitHub

Release Changes

  • Implement settings
  • Implemented vector constant support
  • Implemented VM callbacks
  • Implemented line info
  • Added native namecall handler support
  • Added VM extensions
  • Made error handling, generalized iteration and error proxying optional
  • Fixed memory leaks
  • Added luau_close as a return to luau_load for closing an interpreted function
  • Small optimisations
14 Likes

Amazing module!

Do you by any chance know any modules written in Lua (such as Yueliang) to compile luau code to bytecode?

Using Wasynth you can transpile Luau.Compiler into Luau, it wont be the fastest thing ever but it is the most reliable way you can do it.

1 Like

Awesome! I’ll update vLua here in a bit to include the latest release + Luau compiler.

1 Like

very interesting resource, good job!

I was wondering if you can provide example use cases? I would want to use this but i don’t know what to use it for

It serves as a good alternative to loadstring in many cases. We provide closing functionality to prevent the interpreter from running which will allow it to be cleaned up after a wrapped closure stops being used. When you use loadstring there can be cases where what you run will never be cleaned up but this isn’t the case with Fiu when you can call lua_close.

Additionally if you sync up with open cloud or http service you can setup dynamically loadable code using Fiu on both the client and server. That way if you have emergency code you need to push to all of the clients in your game or need to push an emergency fix to your servers you can do so with this.

1 Like

Another example is going to be vLua. Although it still uses the legacy FiOne at the moment along with Yueliang (meaning it only supports vanilla Lua 5.1. Currently waiting for Fiu to support Luau 0.619), it is built to be a batteries-included drop-in replacement to loadstring.

It’s really as easy as doing

local loadstring = require(script.vLua)
loadstring("print'hi'", getfenv())()

The best part is you can modify the fenv without causing any deoptimizations. Pretty nifty huh?

2 Likes