🌟現在、鉄壁 鉄壁ヘッドショットには対応済みです。
鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。

モジュール:CommaTest

提供:Apex Data
ナビゲーションに移動 検索に移動

このモジュールについての説明文ページを モジュール:CommaTest/doc に作成できます

-- Debug: mw.logObject(p.main())
-- from https://gist.github.com/DarkWiiPlayer/9a2cc37daf1147aebbb4664b96078d4c

local p = {}

function p.commas(number)
   return tostring(number) -- Make sure the "number" is a string
		:reverse() -- Reverse the string
		:gsub('%d%d%d', '%0,') -- insert one comma after every 3 numbers
		:gsub(',$', '') -- Remove a trailing comma if present
		:reverse() -- Reverse the string again
		:format() -- a little hack to get rid of the second return value 😜
end

function p.comma_value(amount)
	local formatted = amount
	while true do
		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
		if k==0 then
			break
		end
	end
	return formatted
end

local function bench(func, num, iter)
	local clock = os.clock
	local before = clock()
	for i = 1, iter do
		func(num)
	end
	local after = clock()
	return 1000 * (after - before)
end

function p.main()
	return {
		string.format(
			"%02.7f",
			bench(p.commas, 1, 1e5)
		),
		string.format(
			"%02.7f",
			bench(p.comma_value, 1, 1e5)
		),
		string.format(
			"%02.7f",
			bench(p.commas, 1e3, 1e5)
		),
		string.format(
			"%02.7f",
			bench(p.comma_value, 1e3, 1e5)
		),
		string.format(
			"%02.7f",
			bench(p.commas, math.maxinteger, 1e5)
		),
		--string.format(
		--	"%02.7f",
		--	bench(p.comma_value, math.maxinteger, 1e3)
		--)
	}
end

return p