AdUki / LuaState

Lua51-52 binding library
Apache License 2.0
77 stars 14 forks source link

state["somefunction"] uncallable with std::string arguments #10

Closed fritzy closed 10 years ago

fritzy commented 10 years ago
function test (string1, string2)
  print("String1: "..string1.."\nString2: "..string2);
end
state["test"]("some", "string"); //works fine
std::string s1 = "some";
std::string s2 = "string";
state["test"](s1, s2); // with or without call, causes a compile error
././include/./Traits.h:17:43: error: no member named 'operator()' in 'std::__1::basic_string<char>'
    : public function_traits<decltype(&T::operator())>

It would be nice if std::string was automatically recast to const char *.

AdUki commented 10 years ago

Yes it would, but currently i don't know how to exactly resolve this. This is resolved in library called Selene (but that library is not so efficient in some use cases as LuaState). For now I will mark this as enhancement.

fritzy commented 10 years ago

fixed with pull request.