Skip to content
Permalink
Browse files

More static init / constexpr

  • Loading branch information...
TheCycoONE committed Apr 6, 2019
1 parent 403e6cb commit 8f23dcb7b07bbd264b0cd9ca397216fda0836a55
Showing with 6 additions and 4 deletions.
  1. +3 −2 CorsixTH/Src/lua_rnc.cpp
  2. +3 −2 CorsixTH/Src/persist_lua.cpp
@@ -1,6 +1,7 @@
#include "lua_rnc.h"
#include "../../common/rnc.h"
#include "th_lua.h"
#include <array>

//! Provides lua function to decompress RNC data
/*!
@@ -66,10 +67,10 @@ int l_decompress(lua_State *L)
return 2;
}

const std::vector<luaL_Reg> rnclib = {
constexpr std::array<luaL_Reg, 2> rnclib {{
{"decompress", l_decompress},
{nullptr, nullptr}
};
}};

} // namespace

@@ -28,6 +28,7 @@ SOFTWARE.
#include <vector>
#include <cstdlib>
#include <string>
#include <array>
#ifdef _MSC_VER
#pragma warning(disable: 4996) // Disable "std::strcpy unsafe" warnings under MSVC
#endif
@@ -1449,12 +1450,12 @@ int l_errcatch(lua_State *L)
return 1;
}

const std::vector<luaL_Reg> persist_lib = {
constexpr std::array<luaL_Reg, 2> persist_lib {{
// Due to the various required upvalues, functions are registered
// manually, but we still need a dummy to pass to luaL_register.
{"errcatch", l_errcatch},
{nullptr, nullptr}
};
}};

} // namespace

0 comments on commit 8f23dcb

Please sign in to comment.
You can’t perform that action at this time.