File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 22
33#include " xrScriptEngine/xrScriptEngine.hpp"
44#include < type_traits>
5+ #include < luabind/detail/format_signature.hpp>
56
67namespace luabind
78{
@@ -21,4 +22,32 @@ template<>
2122template <typename ... Args>
2223void functor<void >::operator ()(Args &&...args) const
2324{ call_function<void >(*static_cast <const adl::object *>(this ), std::forward<Args>(args)...); }
25+
26+ namespace detail
27+ {
28+ template <typename T>
29+ struct type_to_string <functor<T>>
30+ {
31+ static void get (lua_State *L)
32+ {
33+ lua_pushstring (L, " function<" );
34+ type_to_string<T>::get (L);
35+ lua_pushstring (L, " >" );
36+ lua_concat (L, 3 );
37+ }
38+ };
39+ }
40+
41+ template <typename T>
42+ struct default_converter <functor<T>> : native_converter_base<functor<T>>
43+ {
44+ static int compute_score (lua_State *luaState, int index)
45+ { return lua_type (luaState, index)==LUA_TFUNCTION ? 0 : -1 ; }
46+
47+ functor<T> from (lua_State *luaState, int index)
48+ { return object (from_stack (luaState, index)); }
49+
50+ void to (lua_State *luaState, const functor<T> &func)
51+ { func.push (luaState); }
52+ };
2453}
You can’t perform that action at this time.
0 commit comments