From b3e7b8ebb3b43e02197683a8e46957bbb16b8ead Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 27 Mar 2020 18:40:55 +0800 Subject: fix moonp repl issue. --- src/MoonP/moon_compiler.cpp | 8 ++++---- src/MoonP/moon_compiler.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/MoonP') diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp index e961a92..d036645 100644 --- a/src/MoonP/moon_compiler.cpp +++ b/src/MoonP/moon_compiler.cpp @@ -42,12 +42,12 @@ inline std::string s(std::string_view sv) { return std::string(sv); } -const char* moonScriptVersion() { - return "0.5.0-r0.3.6"; +const char* version() { + return "0.3.6"; } // name of table stored in lua registry -#define MOONP_MODULE "_modules_" +#define MOONP_MODULE "__moon_modules__" class MoonCompilerImpl { public: @@ -61,6 +61,7 @@ public: BLOCK_START BREAK_IF(!sameModule); BREAK_IF(!L); + _sameModule = true; int top = lua_gettop(L); DEFER(lua_settop(L, top)); lua_pushliteral(L, MOONP_MODULE); // MOONP_MODULE @@ -69,7 +70,6 @@ public: int idx = static_cast(lua_objlen(L, -1)); // idx = #tb, tb BREAK_IF(idx == 0); _useModule = true; - _sameModule = true; BLOCK_END } diff --git a/src/MoonP/moon_compiler.h b/src/MoonP/moon_compiler.h index 573f130..d22a95a 100644 --- a/src/MoonP/moon_compiler.h +++ b/src/MoonP/moon_compiler.h @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI namespace MoonP { -const char* moonScriptVersion(); +const char* version(); struct MoonConfig { bool lintGlobalVariable = false; -- cgit v1.2.3-55-g6feb