Skip to content

Running Lua

Documentation is in ALPHA and is not as verbose as the beta or final release will be. Some minor details might be wrong.


To run Lua code, you simply need to create a bLuaInstance with settings of your choice, or leave the constructor empty if you want to use default settings. Once you've created a bLua instance, you can run Lua code with the DoString function. DoBuffer and ExecBuffer are available for more advanced usage.

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

To run multiple lines of manually-typed Lua code, you can begin your string with the @ symbol:

inst.DoString(@"
    a = 10
    b = 5

    function Test()
        print(a + b)
    end

    Test()
");

Join our community on Discord!

Discord