Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/sol/compatibility/compat-5.4.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ extern "C" {
}
#endif

#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM == 504
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 504

#if !defined(LUA_ERRGCMM)
/* So Lua 5.4 actually removes this, which breaks sol2...
/* So Lua 5.4 or later actually removes this, which breaks sol2...
man, this API is quite unstable...!
*/
# define LUA_ERRGCMM (LUA_ERRERR + 2)
#endif /* LUA_ERRGCMM define */

#endif // Lua 5.4 only
#endif // Lua 5.4 or later

#endif // NOT_KEPLER_PROJECT_COMPAT54_H_
8 changes: 7 additions & 1 deletion include/sol/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include <sol/state_view.hpp>
#include <sol/thread.hpp>

#if LUA_VERSION_NUM >= 505
# define sol_lua_newstate(f, ud) lua_newstate(f, ud, 0)
#else
# define sol_lua_newstate(f, ud) lua_newstate(f, ud)
#endif

namespace sol {

class state : private std::unique_ptr<lua_State, detail::state_deleter>, public state_view {
Expand All @@ -39,7 +45,7 @@ namespace sol {
}

state(lua_CFunction panic, lua_Alloc alfunc, void* alpointer = nullptr)
: unique_base(lua_newstate(alfunc, alpointer)), state_view(unique_base::get()) {
: unique_base(sol_lua_newstate(alfunc, alpointer)), state_view(unique_base::get()) {
set_default_state(unique_base::get(), panic);
}

Expand Down