mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-25 16:43:05 +00:00
promise_tech: fix remaining LuaCheck errors
This commit is contained in:
parent
514a9346ac
commit
287d448d03
1 changed files with 8 additions and 8 deletions
|
@ -54,13 +54,13 @@ local f = function(val) end
|
||||||
--- @class table
|
--- @class table
|
||||||
local table = table
|
local table = table
|
||||||
-- @diagnostic disable-next-line
|
-- @diagnostic disable-next-line
|
||||||
if not table.unpack then table.unpack = unpack end
|
if not table.unpack then table.unpack = unpack end --luacheck: ignore
|
||||||
-- @diagnostic disable-next-line
|
-- @diagnostic disable-next-line
|
||||||
table.join = function(tbl, sep)
|
table.join = function(tbl, sep) --luacheck: ignore
|
||||||
local function fn_iter(tbl,sep,i)
|
local function fn_iter(tbl_inner,sep_inner,i)
|
||||||
if i < #tbl then
|
if i < #tbl_inner then
|
||||||
return (tostring(tbl[i]) or "").. sep .. fn_iter(tbl,sep,i+1)
|
return (tostring(tbl_inner[i]) or "").. sep_inner .. fn_iter(tbl_inner,sep_inner,i+1)
|
||||||
else return (tostring(tbl[i]) or "") end
|
else return (tostring(tbl_inner[i]) or "") end
|
||||||
end
|
end
|
||||||
return fn_iter(tbl,sep,1)
|
return fn_iter(tbl,sep,1)
|
||||||
end
|
end
|
||||||
|
@ -95,7 +95,7 @@ local function_type_warn = function(called_from, position, arg_name, must_be, se
|
||||||
end
|
end
|
||||||
|
|
||||||
local type_enforce = function(called_from, args)
|
local type_enforce = function(called_from, args)
|
||||||
local err_str = nil
|
local err_str
|
||||||
for i, arg in ipairs(args) do
|
for i, arg in ipairs(args) do
|
||||||
local is_err = true
|
local is_err = true
|
||||||
for _, should_be in ipairs(arg.should_be) do
|
for _, should_be in ipairs(arg.should_be) do
|
||||||
|
@ -107,7 +107,7 @@ local type_enforce = function(called_from, args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if is_err then
|
if is_err then
|
||||||
err_str = function_type_warn(called_from, i, arg.name, table.join(arg.should_be, " or "), arg.name == "self" and true or false)
|
err_str = function_type_warn(called_from, i, arg.name, table.join(arg.should_be, " or "), arg.name == "self" and true or false) --luacheck: ignore
|
||||||
if arg.error then error(err_str)
|
if arg.error then error(err_str)
|
||||||
else warn(err_str) end
|
else warn(err_str) end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue