Skip to content

Home

What is bLua?

bLua is a plugin for Unity that allows C# code to easily interact with native Lua 5.4. That means running blazing fast Lua code with a single C# function.

bLuaInstance inst = new bLuaInstance();
inst.DoString("print('Hello world!')");

It's also incredibly easy to mark C# classes as Lua user data so they can be accessed via Lua.

[bLuaUserData] // Add this attribute to any C# class!
public class Character
{
    public int health = 100;

    public void Damage(dmg)
    {
        health -= dmg;
    }
}

inst.SetGlobal("char", new Character());
inst.DoString(@"
    char.Damage(10)
    print(char.health)
");

What makes bLua special?

We run Lua code using native Lua, so your Lua script will run anywhere from 100 - 10,000 times faster than with plugins like Moonsharp! Try our benchmarks yourself here.

bLua is made specifically for Unity projects, so there are no extra steps for getting Lua integrated. Simply clone the bLua repository into your /Assets/Plugins/bLua folder.

bLua also runs on the latest Lua (5.4), which is faster and has more features than other Lua plugins.

Join our community on Discord!

Discord


bLua is in ALPHA

bLua is a relatively new open-source project being developed by a small team of Lua lovers. We're still finishing our interop with native Lua and adding all of the useful features we feel necessary for ease of use and parity with competing plugins. As of writing this (3/17/2023) bLua is completely functional (check out our example project!) but hasn't been user or developer tested.

How can I help?

If you know Unity's C# and Lua's C API, you can join our Discord community or reach out to tyster#0001 to inquire about joining the contributor team. We have an organized list of desired features and bug fixes that we call Bounties that any contributors can grab and start working on. Contributors are listed on the website as thanks for their contributions.

Wanna help other ways? Encourage others to check us out! Drop a star on our main github repository! Point out bugs and make feature requests in our Discord!

Contributors

World to Build logo

Tyster and the team at World to Build actively maintain and upgrade bLua so it can power Lua scripts in over 2,500 user-created World to Build games.

DMHub logo

Denivarius and the team at DMHub created the original native Lua interop that became bLua and actively assist in the development of new features.