diff --git a/sol/compatibility/5.1.0.h b/sol/compatibility/5.1.0.h index 72ddd085..0050b24e 100644 --- a/sol/compatibility/5.1.0.h +++ b/sol/compatibility/5.1.0.h @@ -158,6 +158,9 @@ inline const char* kepler_lua_compat_get_string(lua_State* L, void* ud, size_t* return ls->s; } +#if !defined(SOL_LUAJIT) || ((SOL_LUAJIT_VERSION - 020100) <= 0) +// Luajit 2.1.0 has this function already + inline int luaL_loadbufferx(lua_State* L, const char* buff, size_t size, const char* name, const char*) { kepler_lua_compat_get_string_view ls; ls.s = buff; @@ -165,6 +168,8 @@ inline int luaL_loadbufferx(lua_State* L, const char* buff, size_t size, const c return lua_load(L, kepler_lua_compat_get_string, &ls, name/*, mode*/); } +#endif // LuaJIT 2.1.x beta and beyond + #endif /* Lua 5.1 */ #endif // SOL_5_1_0_H \ No newline at end of file diff --git a/sol/compatibility/version.hpp b/sol/compatibility/version.hpp index 6ec934b8..5ddc23d9 100644 --- a/sol/compatibility/version.hpp +++ b/sol/compatibility/version.hpp @@ -42,6 +42,7 @@ #ifdef LUAJIT_VERSION #ifndef SOL_LUAJIT #define SOL_LUAJIT +#define SOL_LUAJIT_VERSION LUAJIT_VERSION_NUM #endif // sol luajit #endif // luajit