diff --git a/sol/stack_reference.hpp b/sol/stack_reference.hpp index a4f96e83..60704e44 100644 --- a/sol/stack_reference.hpp +++ b/sol/stack_reference.hpp @@ -70,7 +70,7 @@ public: }; 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) { diff --git a/sol/usertype.hpp b/sol/usertype.hpp index d1a0a307..f3c08896 100644 --- a/sol/usertype.hpp +++ b/sol/usertype.hpp @@ -268,7 +268,7 @@ private: } template - void build_function(std::string funcname, no_construction) {} + void build_function(std::string, no_construction) {} template void build_function(std::string funcname, constructors) { @@ -499,8 +499,8 @@ public: // 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()) { lua_createtable(L, 0, 0); - sol::stack_table mt(L, -1); - mt[constructfuncname] = constructfunc; + lua_pushcclosure(L, constructfunc, 0); + lua_setfield(L, -2, constructfuncname); lua_setmetatable(L, -2); } // Make sure to drop a table in the global namespace to properly destroy the pushed functions