| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
モジュール:TableExtensions
ナビゲーションに移動
検索に移動
このモジュールについての説明文ページを モジュール:TableExtensions/doc に作成できます
function table.isEmpty(tbl)
assert(type(tbl) == 'table', debug.traceback())
return not next(tbl)
end
function table.keys(tbl)
assert(type(tbl) == 'table', debug.traceback())
local keyset = {}
for key, _ in pairs(tbl) do
keyset[#keyset + 1] = key
end
return keyset
end
function table.values(tbl)
assert(type(tbl) == 'table', debug.traceback())
local valueset = {}
for _, value in pairs(tbl) do
valueset[#valueset + 1] = value
end
return valueset
end
function table.entries(tbl)
assert(type(tbl) == 'table', debug.traceback())
local entryset = {}
for key, value in pairs(tbl) do
entryset[#entryset + 1] = { key, value }
end
return entryset
end
function table.map(tbl, fn)
assert(type(tbl) == 'table', debug.traceback())
assert(type(fn) == 'function', debug.traceback())
local ret = {}
for key, value in pairs(tbl) do
ret[key] = fn(key, value)
end
return ret
end
function table.mapKeys(tbl, fn)
assert(type(tbl) == 'table', debug.traceback())
assert(type(fn) == 'function', debug.traceback())
local ret = {}
for key, value in pairs(tbl) do
ret[fn(key)] = value
end
return ret
end
function table.mapValues(tbl, fn)
assert(type(tbl) == 'table', debug.traceback())
assert(type(fn) == 'function', debug.traceback())
local ret = {}
for key, value in pairs(tbl) do
ret[key] = fn(value)
end
return ret
end
function table.filter(tbl, fn)
assert(type(tbl) == 'table', debug.traceback())
assert(type(fn) == 'function', debug.traceback())
local ret = {}
for idx, value in ipairs(tbl) do
if fn(idx, value) then
ret[#ret + 1] = value
end
end
for key, value in pairs(tbl) do
if type(key) ~= 'number' and fn(key, value) then
ret[key] = value
end
end
return ret
end
function table.removeKey(tbl, key)
assert(type(tbl) == 'table', debug.traceback())
local element = tbl[key]
tbl[key] = nil
return element
end
function table.reverse(tbl)
assert(type(tbl) == 'table', debug.traceback())
local n = #tbl
local i = 1
while i < n do
tbl[i], tbl[n] = tbl[n], tbl[i]
i = i + 1
n = n - 1
end
end
function table.reversed(tbl)
assert(type(tbl) == 'table', debug.traceback())
local ret = {}
for i = #tbl, 1, -1 do
ret[#ret + 1] = tbl[i]
end
return ret
end
return table