2021-03-06 10:14:48 -05:00
|
|
|
// sol2
|
2017-12-20 04:58:32 -05:00
|
|
|
|
2017-09-13 02:46:56 -04:00
|
|
|
// The MIT License (MIT)
|
2016-03-31 16:16:07 -04:00
|
|
|
|
2022-06-25 04:00:53 -04:00
|
|
|
// Copyright (c) 2013-2022 Rapptz, ThePhD and contributors
|
2016-03-31 16:16:07 -04:00
|
|
|
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
|
|
// this software and associated documentation files (the "Software"), to deal in
|
|
|
|
|
// the Software without restriction, including without limitation the rights to
|
|
|
|
|
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
|
|
|
// the Software, and to permit persons to whom the Software is furnished to do so,
|
|
|
|
|
// subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
|
|
|
// copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
|
|
|
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
|
|
|
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
|
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
#ifndef SOL_STACK_PROXY_HPP
|
|
|
|
|
#define SOL_STACK_PROXY_HPP
|
|
|
|
|
|
2020-08-09 17:17:06 -04:00
|
|
|
#include <sol/stack_proxy_base.hpp>
|
2016-03-31 16:16:07 -04:00
|
|
|
|
|
|
|
|
namespace sol {
|
2017-11-09 17:41:46 -05:00
|
|
|
struct stack_proxy : public stack_proxy_base {
|
2016-06-19 17:59:40 -04:00
|
|
|
public:
|
2020-03-31 00:22:46 -04:00
|
|
|
stack_proxy() : stack_proxy_base() {
|
2017-09-13 02:46:56 -04:00
|
|
|
}
|
2020-03-31 00:22:46 -04:00
|
|
|
stack_proxy(lua_State* L, int index) : stack_proxy_base(L, index) {
|
2017-09-13 02:46:56 -04:00
|
|
|
}
|
2016-06-19 17:59:40 -04:00
|
|
|
|
2017-09-13 02:46:56 -04:00
|
|
|
template <typename... Ret, typename... Args>
|
2017-11-09 17:41:46 -05:00
|
|
|
decltype(auto) call(Args&&... args);
|
2016-06-19 17:59:40 -04:00
|
|
|
|
2017-09-13 02:46:56 -04:00
|
|
|
template <typename... Args>
|
2016-06-19 17:59:40 -04:00
|
|
|
decltype(auto) operator()(Args&&... args) {
|
|
|
|
|
return call<>(std::forward<Args>(args)...);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
namespace stack {
|
|
|
|
|
template <>
|
2018-12-19 23:17:15 -05:00
|
|
|
struct unqualified_getter<stack_proxy> {
|
2020-03-31 00:22:46 -04:00
|
|
|
static stack_proxy get(lua_State* L, int index, record& tracking) {
|
|
|
|
|
tracking.use(0);
|
2016-06-19 17:59:40 -04:00
|
|
|
return stack_proxy(L, index);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <>
|
2018-12-22 15:36:42 -05:00
|
|
|
struct unqualified_pusher<stack_proxy> {
|
2016-06-19 17:59:40 -04:00
|
|
|
static int push(lua_State*, const stack_proxy& ref) {
|
|
|
|
|
return ref.push();
|
|
|
|
|
}
|
|
|
|
|
};
|
2017-09-13 02:46:56 -04:00
|
|
|
} // namespace stack
|
|
|
|
|
} // namespace sol
|
2016-03-31 16:16:07 -04:00
|
|
|
|
|
|
|
|
#endif // SOL_STACK_PROXY_HPP
|