Add guard for luaL_loadbufferx

This commit is contained in:
ThePhD 2016-09-04 11:41:24 -04:00
parent d451271bf4
commit cb0116a3df
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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