Skip to content

Commit

Permalink
Fixed issue #183 and issue #185.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Jan 29, 2025
1 parent 891992d commit 8a77132
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/yuescript/yue_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = {
"close"s // Lua 5.4
};

const std::string_view version = "0.26.1"sv;
const std::string_view version = "0.26.2"sv;
const std::string_view extension = "yue"sv;

class CompileError : public std::logic_error {
Expand Down Expand Up @@ -7078,7 +7078,7 @@ class YueCompilerImpl {
} else {
for (const auto& exp : tmp) {
_buf << exp << " == "sv << varName;
if (exp != tmp.back()) {
if (&exp != &tmp.back()) {
_buf << " or "sv;
}
}
Expand Down
27 changes: 12 additions & 15 deletions src/yuescript/yuescript.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,20 @@ local function yue_traceback(err, level)
stp.simplified = yue.options.simplified
return stp.stacktrace(err, level)
end
local function yue_require(name)
insert_loader()
local success, res = xpcall(function()
return require(name)
end, function(err)
return yue_traceback(err, 3)
end)
if success then
return res
else
print(res)
return nil
end
end
setmetatable(yue, {
__call = function(self, name)
return self.require(name)
insert_loader()
local success, res = xpcall(function()
return require(name)
end, function(err)
return yue_traceback(err, 3)
end)
if success then
return res
else
print(res)
return nil
end
end
})
local function dump(what)
Expand Down

0 comments on commit 8a77132

Please sign in to comment.