summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/control/ScriptContext.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0cdd80d..25165ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/src/control/ScriptContext.cpp b/src/control/ScriptContext.cpp
index b92c8e5..e92e275 100644
--- a/src/control/ScriptContext.cpp
+++ b/src/control/ScriptContext.cpp
@@ -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"}) {