diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
| -rw-r--r-- | src/yuescript/yuescript.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
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 |
