現在、luabind を使用してクラスをバインドしています (正確には SFML 2.0 の sf::Time を使用しています)、luabind から例外が発生し続けています。ここに私のバインディングコードがあります:
using namespace luabind;
module(L, "system")
[
class_<sf::Time>("Time")
.def(constructor<>())
.def("toSeconds", &sf::Time::asSeconds)
.def("toMilliseconds", &sf::Time::asMilliseconds)
.def("toMicroseconds", &sf::Time::asMicroseconds)
.def(self == other<sf::Time>())
.def(self < other<sf::Time>())
.def(self <= other<sf::Time>())
.def(self - other<sf::Time>())
.def(self + other<sf::Time>())
.def(self * float())
.def(self / float())
.scope
[
def("seconds", &sf::seconds),
def("milliseconds", &sf::milliseconds),
def("microseconds", &sf::microseconds)
],
...
私のルアコードは次のとおりです。
local t = system.Time.seconds(10)
sf::seconds の署名は次のとおりです。
sf::Time sf::seconds(float)
sf::Time を返す独自の関数で sf::seconds への呼び出しをラップしてみました。また、戻り値として sf::Time* を使用してみました。何があっても、エラーが発生し続けます。
何か案は?
編集:
クラス自体をテストしましたが、Lua で system.Time() を使用して作成できますが、問題ありません。すべてのメソッドは正しく機能しますが、system.Time.seconds およびその他の静的メソッドは機能しません。