I'm currently using luabind to bind a class (sf::Time from SFML 2.0 to be exact), and I keep getting 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)
The signature of sf::seconds is:
sf::Time sf::seconds(float)
I've tried wrapping the call to sf::seconds in my own function that returns sf::Time, and I tried using sf::Time* as the return value as well. No matter what, I keep getting the error.
Any ideas?
EDIT:
I have tested the class its self, and i can create it in Lua using system.Time(), no problem. All the methods work correctly, but system.Time.seconds and the other static methods don't work.