diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
-rw-r--r-- | src/yuescript/yuescript.cpp | 9 |
3 files changed, 11 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fc2c234..3ecec9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -54,6 +54,10 @@ enable_language(CXX) | |||
54 | include_directories(src src/3rdParty ${LUA_INCLUDE_DIR}) | 54 | include_directories(src src/3rdParty ${LUA_INCLUDE_DIR}) |
55 | add_definitions(-std=c++17 -O3 -fPIC) | 55 | add_definitions(-std=c++17 -O3 -fPIC) |
56 | 56 | ||
57 | if (APPLE) | ||
58 | add_definitions(-Wno-deprecated-declarations) | ||
59 | endif () | ||
60 | |||
57 | add_library(libyue MODULE | 61 | add_library(libyue MODULE |
58 | src/yuescript/ast.cpp | 62 | src/yuescript/ast.cpp |
59 | src/yuescript/parser.cpp | 63 | src/yuescript/parser.cpp |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index a566fae..5c8ff5e 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -72,7 +72,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
72 | "close"s // Lua 5.4 | 72 | "close"s // Lua 5.4 |
73 | }; | 73 | }; |
74 | 74 | ||
75 | const std::string_view version = "0.16.2"sv; | 75 | const std::string_view version = "0.16.3"sv; |
76 | const std::string_view extension = "yue"sv; | 76 | const std::string_view extension = "yue"sv; |
77 | 77 | ||
78 | class CompileError : public std::logic_error { | 78 | class CompileError : public std::logic_error { |
diff --git a/src/yuescript/yuescript.cpp b/src/yuescript/yuescript.cpp index ac1332e..933c77d 100644 --- a/src/yuescript/yuescript.cpp +++ b/src/yuescript/yuescript.cpp | |||
@@ -379,9 +379,12 @@ YUE_API int luaopen_yue(lua_State* L) { | |||
379 | #if LUA_VERSION_NUM > 501 | 379 | #if LUA_VERSION_NUM > 501 |
380 | luaL_newlib(L, yuelib); // yue | 380 | luaL_newlib(L, yuelib); // yue |
381 | #else | 381 | #else |
382 | lua_getglobal(L, "package"); | 382 | lua_getglobal(L, "package"); // package |
383 | lua_getfield(L, -1, "loaded"); | 383 | lua_getfield(L, -1, "loaded"); // package loaded |
384 | luaL_register(L, nullptr, yuelib); // yue | 384 | lua_createtable(L, 0, 0); // package loaded yue |
385 | lua_pushvalue(L, -1); // package loaded yue yue | ||
386 | lua_setfield(L, -3, "yue"); // loaded["yue"] = yue, package loaded yue | ||
387 | luaL_register(L, nullptr, yuelib); // package loaded yue | ||
385 | #endif | 388 | #endif |
386 | lua_pushlstring(L, &yue::version.front(), yue::version.size()); // yue version | 389 | lua_pushlstring(L, &yue::version.front(), yue::version.size()); // yue version |
387 | lua_setfield(L, -2, "version"); // yue["version"] = version, yue | 390 | lua_setfield(L, -2, "version"); // yue["version"] = version, yue |