MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / push_as_upvalues

Function push_as_upvalues

extlibs/sol3/include/sol/sol.hpp:14407–14422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14405 namespace stack_detail {
14406 template <typename T>
14407 inline int push_as_upvalues(lua_State* L, T& item) {
14408 typedef std::decay_t<T> TValue;
14409 static const std::size_t itemsize = sizeof(TValue);
14410 static const std::size_t voidsize = sizeof(void*);
14411 static const std::size_t voidsizem1 = voidsize - 1;
14412 static const std::size_t data_t_count = (sizeof(TValue) + voidsizem1) / voidsize;
14413 typedef std::array<void*, data_t_count> data_t;
14414
14415 data_t data{ {} };
14416 std::memcpy(&data[0], std::addressof(item), itemsize);
14417 int pushcount = 0;
14418 for (auto&& v : data) {
14419 pushcount += push(L, lightuserdata_value(v));
14420 }
14421 return pushcount;
14422 }
14423
14424 template <typename T>
14425 inline std::pair<T, int> get_as_upvalues(lua_State* L, int index = 2) {

Callers 2

select_member_variableFunction · 0.85
selectFunction · 0.85

Calls 2

pushFunction · 0.85
lightuserdata_valueClass · 0.85

Tested by

no test coverage detected