如何在 C++ 中注册松鼠 class

How to register a Squirrel class in C++

您好,我正在尝试在 C++ 应用程序中使用 Squirrel。 出于这个原因,我想在 C++ 中注册一个 Squirrel class。
下面以class为例

class Foo
{
    constructor(value)
    {
        ::print("constructor called");
        this.testValue = value;
    }

    function saySomething()
    {
        ::print("The value is: " + this.testValue);
    }

    testValue = 0;
}

任何人都可以告诉我如何在 C++ 中绑定它吗?

我能够做到这一点,通过使用 this code

在我的示例中,它看起来像这样:

sqext::SQIClass testClass(L"Foo");
testClass.bind(0, L"testValue");
testClass.bind(1, L"saySomething");

sqext::SQIClassInstance test = testClass.New(4711);
test.call(1);