문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 중 하나의 권한을 가진 사용자에게 제한됩니다: 사용자, 관리자. 문서를 고치려면 이메일 인증 절차가 필요합니다. 사용자 환경 설정에서 이메일 주소를 입력하고 이메일 주소 인증을 해주시기 바랍니다. 문서의 원본을 보거나 복사할 수 있습니다. local p = {} -- 별점 개선 function p.calculate_average(frame) -- 점수 배열 가져오기 local args = frame.args local scores = {} for _, value in ipairs(args) do local score = tonumber(value) if score then if score >= 0 and score <= 5 then table.insert(scores, score) else return "점수는 0에서 5 사이여야 합니다." end end end -- 점수가 없으면 에러 메시지 출력 if #scores == 0 then return "점수가 입력되지 않았습니다." end -- 점수 합산 및 평균 계산 local sum = 0 for _, score in ipairs(scores) do sum = sum + score end local average = sum / #scores -- 소수점 둘째 자리에서 반올림 average = math.floor(average * 100 + 0.5) / 100 -- 불필요한 0 제거 후 반환 local result = tostring(average) if result:find("%.") then result = result:gsub("0+$", ""):gsub("%.$", "") end return result end return p 이 문서에서 사용한 틀: 틀:Namucat/css (원본 보기) 틀:Namucat/styles.css (원본 보기) 틀:Navbarcolor (원본 보기) 틀:Sidebarcolor (원본 보기) 틀:Style (원본 보기) 틀:내비게이션 바 색상 (원본 보기) 틀:사이드 바 색상 (원본 보기) 틀:편집 버튼 (원본 보기) 모듈:Average (원본 보기) 모듈:Average/설명문서 (원본 보기) 모듈:Average 문서로 돌아갑니다.