mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Ordering issues make me sad.
This commit is contained in:
parent
27a8dde1e6
commit
2aa5ab77a8
|
@ -70,7 +70,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator== (const stack_reference& l, const stack_reference& r) {
|
inline bool operator== (const stack_reference& l, const stack_reference& r) {
|
||||||
return lua_compare(l.lua_state(), l.stack_index(), l.stack_index(), LUA_OPEQ) == 0;
|
return lua_compare(l.lua_state(), l.stack_index(), r.stack_index(), LUA_OPEQ) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator!= (const stack_reference& l, const stack_reference& r) {
|
inline bool operator!= (const stack_reference& l, const stack_reference& r) {
|
||||||
|
|
|
@ -268,7 +268,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t N>
|
template<std::size_t N>
|
||||||
void build_function(std::string funcname, no_construction) {}
|
void build_function(std::string, no_construction) {}
|
||||||
|
|
||||||
template<std::size_t N, typename... Args>
|
template<std::size_t N, typename... Args>
|
||||||
void build_function(std::string funcname, constructors<Args...>) {
|
void build_function(std::string funcname, constructors<Args...>) {
|
||||||
|
@ -499,8 +499,8 @@ public:
|
||||||
// be sure to link the construction function to allow for people to do the whole lua_bind thing
|
// be sure to link the construction function to allow for people to do the whole lua_bind thing
|
||||||
if (constructfunc != nullptr && constructfuncname != nullptr && std::find(meta_function_names.cbegin(), meta_function_names.cend(), constructfuncname) != meta_function_names.cend()) {
|
if (constructfunc != nullptr && constructfuncname != nullptr && std::find(meta_function_names.cbegin(), meta_function_names.cend(), constructfuncname) != meta_function_names.cend()) {
|
||||||
lua_createtable(L, 0, 0);
|
lua_createtable(L, 0, 0);
|
||||||
sol::stack_table mt(L, -1);
|
lua_pushcclosure(L, constructfunc, 0);
|
||||||
mt[constructfuncname] = constructfunc;
|
lua_setfield(L, -2, constructfuncname);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
}
|
}
|
||||||
// Make sure to drop a table in the global namespace to properly destroy the pushed functions
|
// Make sure to drop a table in the global namespace to properly destroy the pushed functions
|
||||||
|
|
Loading…
Reference in New Issue
Block a user