Skip to content

Commit

Permalink
Fix undeclared identifier error with Lua 5.4+
Browse files Browse the repository at this point in the history
The LUA_ERRGCMM constant has been removed.
See: https://www.lua.org/manual/5.4/manual.html#8.3
  • Loading branch information
LHLaurini committed Feb 24, 2022
1 parent a4ba0c7 commit 77b8c4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/Registry/LuaCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ void inline _checkErrorAndThrow(LuaState &L, int error) {
case LUA_ERRMEM:
throw std::runtime_error("Out of memory");
break;
#if LUA_VERSION_NUM < 504
case LUA_ERRGCMM:
throw std::out_of_range("GC Error while loading");
break;
#endif
case LUA_ERRSYNTAX:
throw std::logic_error(lua_tostring(L,1));
break;
Expand Down
2 changes: 2 additions & 0 deletions Source/UnitTest/TestLuaCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ namespace LuaCpp {
EXPECT_NO_THROW(_checkErrorAndThrow(*L, LUA_OK));
EXPECT_THROW(_checkErrorAndThrow(*L, LUA_ERRMEM), std::runtime_error);
lua_pushstring(*L, "some error");
#if LUA_VERSION_NUM < 504
EXPECT_THROW(_checkErrorAndThrow(*L, LUA_ERRGCMM), std::out_of_range);
#endif
EXPECT_THROW(_checkErrorAndThrow(*L, LUA_ERRSYNTAX), std::logic_error);

EXPECT_THROW(_checkErrorAndThrow(*L, 9999), std::runtime_error);
Expand Down

0 comments on commit 77b8c4d

Please sign in to comment.