diff options
author | Li Jin <dragon-fly@qq.com> | 2023-03-23 18:26:56 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-03-23 18:26:56 +0800 |
commit | 40b4b41d27573904203bdbba311e78aa44ae421d (patch) | |
tree | 31f1fa941ff8cfda5d91ab4ead949010d04b53e5 | |
parent | b3d021e2bbb08d01961d2a597715faff5e78b715 (diff) | |
download | yuescript-40b4b41d27573904203bdbba311e78aa44ae421d.tar.gz yuescript-40b4b41d27573904203bdbba311e78aa44ae421d.tar.bz2 yuescript-40b4b41d27573904203bdbba311e78aa44ae421d.zip |
fix yue.loadfile for issue #129.
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 | ||||
-rw-r--r-- | src/yuescript/yuescript.h | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 8a63098..8c99303 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.15.29"sv; | 75 | const std::string_view version = "0.15.30"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.h b/src/yuescript/yuescript.h index b007797..271a982 100644 --- a/src/yuescript/yuescript.h +++ b/src/yuescript/yuescript.h | |||
@@ -125,8 +125,11 @@ yue_loadstring = function(...) | |||
125 | })) | 125 | })) |
126 | end | 126 | end |
127 | local function yue_loadfile(fname, ...) | 127 | local function yue_loadfile(fname, ...) |
128 | local text = yue.read_file(fname) | 128 | local res, err = yue.read_file(fname) |
129 | return yue_loadstring(text, fname, ...) | 129 | if not res then |
130 | return nil, err | ||
131 | end | ||
132 | return yue_loadstring(res, fname, ...) | ||
130 | end | 133 | end |
131 | local function yue_dofile(...) | 134 | local function yue_dofile(...) |
132 | local f = assert(yue_loadfile(...)) | 135 | local f = assert(yue_loadfile(...)) |