mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
get
variant to easily get std::function from sol::function when using lua's call syntax.
This commit is contained in:
parent
c85fe4dc95
commit
5d5ce9cd2e
@ -26,6 +26,7 @@
|
|||||||
#include "tuple.hpp"
|
#include "tuple.hpp"
|
||||||
#include "stack.hpp"
|
#include "stack.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
class function : public reference {
|
class function : public reference {
|
||||||
@ -79,6 +80,15 @@ public:
|
|||||||
return invoke(types<Ret...>(), sizeof...(Args));
|
return invoke(types<Ret...>(), sizeof...(Args));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace stack {
|
||||||
|
namespace detail {
|
||||||
|
template <typename Signature>
|
||||||
|
inline std::function<Signature> get(types<std::function<Signature>>, lua_State* L, int index = -1) {
|
||||||
|
return std::function<Signature>(sol::function(L, index));
|
||||||
|
}
|
||||||
|
} // detail
|
||||||
|
} // stack
|
||||||
} // sol
|
} // sol
|
||||||
|
|
||||||
#endif // SOL_FUNCTION_HPP
|
#endif // SOL_FUNCTION_HPP
|
||||||
|
@ -208,4 +208,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // sol
|
} // sol
|
||||||
|
|
||||||
#endif // SOL_STATE_HPP
|
#endif // SOL_STATE_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user