Liebesfreud (토론 | 기여) 잔글편집 요약 없음 |
Liebesfreud (토론 | 기여) 잔글편집 요약 없음 |
||
8번째 줄: | 8번째 줄: | ||
while numstars > 0.5 do | while numstars > 0.5 do | ||
result = result .. fullstar | result = result .. fullstar | ||
numstars = numstars - 1 | |||
end | end | ||
if numstars > 0 then | if numstars > 0 then | ||
result = result .. halfstar | result = result .. halfstar | ||
numstars = 0 | |||
end | end | ||
return result | return result | ||
end | end | ||
return p | return p |
2020년 12월 5일 (토) 20:26 판
이 모듈의 설명문서는 모듈:Stars/설명문서에서 편집할 수 있습니다.
이 모듈은 틀:Stars 내에서 별의 개수가 제한되는 문제를 해결하기 위해 제작된 모듈입니다. 문서 내 삽입을 위해서는 틀:Stars를 사용하는 것을 권장드립니다.
작동 원리
{{#invoke:Stars|stars|별 개수|별 반 개 문자|별 한 개 문자}}
예시
{{#invoke:Stars|stars|16.5|☆|★}}
★★★★★★★★★★★★★★★★☆{{#invoke:Stars|stars|9|✦|✪}}
✪✪✪✪✪✪✪✪✪
local p = {}
function p.stars(frame)
local input = frame.args[1]
local fullstar = frame.args[3]
local halfstar = frame.args[2]
local numstars = tonumber(input)
local result = ""
while numstars > 0.5 do
result = result .. fullstar
numstars = numstars - 1
end
if numstars > 0 then
result = result .. halfstar
numstars = 0
end
return result
end
return p