Skip to content

Commit

Permalink
Merge pull request #8 from LHLaurini/main
Browse files Browse the repository at this point in the history
[FIX] Fix undeclared identifier error with Lua 5.4+
[IMP] Support for Lua 5.4+
  • Loading branch information
jordanvrtanoski authored Feb 27, 2022
2 parents a4ba0c7 + 77b8c4d commit d7171e8
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 d7171e8

Please sign in to comment.