モジュールの解説[作成]
local ScoreRateFormat = {}

function toarray(table)
  local values = {}
  for key,value in pairs(table) do
    key = tonumber(key)
    if key then
      values[key] = value
    end
  end
  return values
end

function ScoreRateFormat.apply (frame)
  local a = tonumber(frame.args[1])
  local b = tonumber(frame.args[2])
  local c = frame.args[3] or ""
  if b == 0 then
  	return c
  else
    local a_b = a/b
    if a_b < 1 then
      return string.sub (string.format ("%.3f", a_b), 2)
    else
      return string.format ("%.3f", a_b)
    end
  end
end

return ScoreRateFormat