how to register a C# class constructor in Lua

Viewed 387

I'm using a c# class:

public class TestClass
    {
        int _a;
        public void Set(int a)
        {
            _a = a;
        }
        public void Print()
        {
            Console.WriteLine(_a);
        }
    }

and register it:

Lua lua = new Lua();
lua["Debug"] = new TestClass();
lua.DoFile("script.lua");

and call it from script next way:

a=Debug
a:Set(5)
a:Print()

What should I change/add to use constructor with parameters?

1 Answers
Related