Skip to content

Commit f41f794

Browse files
committed
Fix tests for lua 5.5
1 parent ba62277 commit f41f794

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

‎Source/LuaBridge/detail/LuaHelpers.h‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ inline int lua_getstack_info_x(lua_State* L, int level, const char* what, lua_De
123123

124124
#endif // LUABRIDGE_ON_LUAU
125125

126+
// These are for Lua versions prior to 5.5.0.
127+
#if LUA_VERSION_NUM < 505
128+
inline lua_State* lua_newstate_x(lua_Alloc f, void* ud, [[maybe_unused]] unsigned seed)
129+
{
130+
return lua_newstate(f, ud);
131+
}
132+
#else
133+
inline lua_State* lua_newstate_x(lua_Alloc f, void* ud, unsigned seed)
134+
{
135+
return lua_newstate(f, ud, seed);
136+
}
137+
#endif
138+
126139
// These are for Lua versions prior to 5.3.0.
127140
#if LUA_VERSION_NUM < 503
128141
inline lua_Number to_numberx(lua_State* L, int idx, int* isnum)

‎Tests/Lua/LuaLibrary.h‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// The value is the same as LUA_VERSION_NUM in lua.h
3434

3535
#ifndef LUABRIDGE_TEST_LUA_VERSION
36-
#define LUABRIDGE_TEST_LUA_VERSION 504 // By default use 5.4
36+
#define LUABRIDGE_TEST_LUA_VERSION 505 // By default use 5.5
3737
#endif
3838

3939
#if !defined(LUALIBRARY_SOURCE)
@@ -49,13 +49,22 @@
4949
#elif LUABRIDGE_TEST_LUAJIT
5050
#include "LuaJIT.2.1/src/lua.hpp"
5151

52+
#elif LUABRIDGE_TEST_LUA_VERSION >= 505
53+
#ifdef __cplusplus
54+
#include "Lua.5.5.0/src/lua.hpp"
55+
#else
56+
#include "Lua.5.5.0/src/lua.h"
57+
#include "Lua.5.5.0/src/lualib.h"
58+
#include "Lua.5.5.0/src/lauxlib.h"
59+
#endif
60+
5261
#elif LUABRIDGE_TEST_LUA_VERSION >= 504
5362
#ifdef __cplusplus
54-
#include "Lua.5.4.6/src/lua.hpp"
63+
#include "Lua.5.4.8/src/lua.hpp"
5564
#else
56-
#include "Lua.5.4.6/src/lua.h"
57-
#include "Lua.5.4.6/src/lualib.h"
58-
#include "Lua.5.4.6/src/lauxlib.h"
65+
#include "Lua.5.4.8/src/lua.h"
66+
#include "Lua.5.4.8/src/lualib.h"
67+
#include "Lua.5.4.8/src/lauxlib.h"
5968
#endif
6069

6170
#elif LUABRIDGE_TEST_LUA_VERSION >= 503

‎Tests/Source/TestBase.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct TestBase : public ::testing::Test
9797
lua_State* l;
9898

9999
if (alloc)
100-
l = lua_newstate(alloc, nullptr);
100+
l = luabridge::lua_newstate_x(alloc, nullptr, 0);
101101
else
102102
l = luaL_newstate();
103103

0 commit comments

Comments
 (0)