AdUki / LuaState

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

Automatic std::string cast from lua::Function #1

Closed AdUki closed 10 years ago

AdUki commented 10 years ago
state.doString("function cat(a,b) return a .. b end");
std::string text = state["cat"]("aa","bb"));

Has compile error:

/Users/Simon/workspace/LuaState/test/Test.cpp:160:10: Use of overloaded operator '=' is ambiguous (with operand types 'std::string' (aka 'basic_string<char, char_traits, allocator >') and 'lua::Function')

Workaround:

std::string text = lua::String(state["cat"]("aa","bb"));
AdUki commented 10 years ago

since 984d733c6f97e63fb95096be77f23dcc07682015

std::string str = state["func"]().toString();