Update to Lua 5.3

This commit is contained in:
Matthias Schiffer 2015-12-09 23:52:21 +01:00
parent c5a98c282b
commit 4135928a9f
2 changed files with 6 additions and 4 deletions

View file

@ -5,6 +5,6 @@ project(RPGEDIT CXX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2 SDL2_image)
find_package(Lua 5.2 EXACT REQUIRED)
find_package(Lua 5.3 EXACT REQUIRED)
add_subdirectory(src)

View file

@ -34,15 +34,17 @@ namespace Control {
void ScriptContext::setupEnv() {
const std::pair<const char *, lua_CFunction> libs[] = {
{"_G", luaopen_base},
{"bit32", luaopen_bit32},
{"math", luaopen_math},
{"string", luaopen_string},
{"table", luaopen_table},
{"utf8", luaopen_utf8},
};
for (auto &lib : libs) {
luaL_requiref(L, lib.first, lib.second, 1);
lua_pop(L, 1);
lua_pushcfunction(L, lib.second);
lua_pushstring(L, lib.first);
lua_call(L, 1, 1);
lua_setglobal(L, lib.first);
}
for (const char *f : {"dofile", "loadfile", "require"}) {