MCPcopy Create free account
hub / github.com/ThePhD/sol2 / get_as_upvalues

Function get_as_upvalues

include/sol/stack.hpp:114–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113 template <typename T>
114 inline std::pair<T, int> get_as_upvalues(lua_State* L, int index = 2) {
115 static const std::size_t data_t_count = (sizeof(T) + (sizeof(void*) - 1)) / sizeof(void*);
116 typedef std::array<void*, data_t_count> data_t;
117 data_t voiddata { {} };
118 for (std::size_t i = 0, d = 0; d < sizeof(T); ++i, d += sizeof(void*)) {
119 voiddata[i] = lua_touserdata(L, upvalue_index(index++));
120 }
121 return std::pair<T, int>(*reinterpret_cast<T*>(static_cast<void*>(voiddata.data())), index);
122 }
123
124 template <typename T>
125 inline std::pair<T, int> get_as_upvalues_using_function(lua_State* L, int function_index = -1) {

Callers

nothing calls this directly

Calls 2

upvalue_indexClass · 0.85
dataMethod · 0.45

Tested by

no test coverage detected