| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:Utility/Library」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local aw = {} function aw.shallowCopy(obj) local typename = type(obj) local copy if typename == 'table' then copy = {} for key, value in pairs(obj) do copy[key…」) |
(文字列から真偽値に変換する際の不具合を修正) |
||
| 24行目: | 24行目: | ||
return strOrNumOrBool ~= 0 | return strOrNumOrBool ~= 0 | ||
elseif typename == 'string' then | elseif typename == 'string' then | ||
local str = | local str = string.lower(strOrNumOrBool) | ||
return str == 'true' or str == 't' or str | return str == 'true' or str == 't' or str == '1' | ||
else | else | ||
return defaultValue | return defaultValue | ||
2021年2月1日 (月) 18:17時点における版
このモジュールについての説明文ページを モジュール:Utility/Library/doc に作成できます
local aw = {}
function aw.shallowCopy(obj)
local typename = type(obj)
local copy
if typename == 'table' then
copy = {}
for key, value in pairs(obj) do
copy[key] = value
end
else
copy = obj
end
return copy
end
function aw.getAsBoolean(strOrNumOrBool, defaultValue)
defaultValue = defaultValue or false
local typename = type(strOrNumOrBool)
if typename == 'boolean' then
return strOrNumOrBool
elseif typename == 'number' then
return strOrNumOrBool ~= 0
elseif typename == 'string' then
local str = string.lower(strOrNumOrBool)
return str == 'true' or str == 't' or str == '1'
else
return defaultValue
end
end
function aw.getAsNumber(strOrNum, defaultValue)
defaultValue = defaultValue or 0
local typename = type(strOrNum)
if typename == 'number' then
return strOrNum
elseif typename == 'string' then
return tonumber(strOrNum)
else
return defaultValue
end
end
return aw