Luabind 'Attempting to use an unregistered class' upon return

I am currently using luabind to bind a class (sf :: Time from SFML 2.0, to be precise), and I continue to get an exception from luabind. Here is my binding code:

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) ], ... 

My lua code is:

 local t = system.Time.seconds(10) 

Signature sf :: seconds:

 sf::Time sf::seconds(float) 

I tried to wrap a call to sf :: seconds in my own function that returns sf :: Time, and I tried to use sf :: Time * as the return value. Regardless, I keep getting the error.

Any ideas?

EDIT:

I tested the class myself, and I can create it in Lua using system.Time (), no problem. All methods work correctly, but system.Time.seconds and other static methods do not work.

+4
source share

All Articles