Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interpreter crash #794

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/uosc/lib/intl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ function get_locale_from_json(path)

local meta, meta_error = utils.file_info(expand_path)
if not meta or not meta.is_file then
return {}
return nil
end

local json_file = io.open(expand_path, 'r')
if not json_file then
return {}
return nil
end

local json = json_file:read('*all')
json_file:close()

return utils.parse_json(json)
local json_table = utils.parse_json(json)
return json_table
end

---@param text string
Expand Down
6 changes: 3 additions & 3 deletions src/uosc/lib/std.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ end
---@return T[]
function itable_join(...)
local args, result = {...}, {}
for i = 1, #args do
for i = 1, select('#', ...) do
if args[i] then for _, value in ipairs(args[i]) do result[#result + 1] = value end end
end
return result
Expand Down Expand Up @@ -201,8 +201,8 @@ end
---@return T
function table_assign(target, ...)
local args = {...}
for i = 1, #args do
if args[i] then for key, value in pairs(args[i]) do target[key] = value end end
for i = 1, select('#', ...) do
if type(args[i]) == 'table' then for key, value in pairs(args[i]) do target[key] = value end end
end
return target
end
Expand Down