Kairosoft Wiki
(Created page with "-- -- This module implements {{StarPoll}} -- local p = {} function p.starPoll(frame) local args = frame.args; local t = {} t[#t+1] = "<div id='starRatingPo...")
Tag: sourceedit
 
No edit summary
Tag: sourceedit
 
(9 intermediate revisions by the same user not shown)
Line 6: Line 6:
   
 
function p.starPoll(frame)
 
function p.starPoll(frame)
local args = frame.args;
+
local args = frame.args
  +
local pArgs = frame:getParent().args
  +
  +
local pollName = args[1] or pArgs[1] or "Example"
 
 
 
local t = {}
 
local t = {}
  +
t[#t+1] = "<h2 id='starRatingPollHeading'>Game Rating</h2>"
 
t[#t+1] = "<div id='starRatingPollCont'>"
 
t[#t+1] = "<div id='starRatingPollCont'>"
 
t[#t+1] = "<poll>"
 
t[#t+1] = "<poll>"
t[#t+1] = args[1] .. "Rating"
+
t[#t+1] = pollName .. " Rating"
t[#t+1] = "★"
 
t[#t+1] = "★★"
 
t[#t+1] = "★★★"
 
t[#t+1] = "★★★★"
 
 
t[#t+1] = "★★★★★"
 
t[#t+1] = "★★★★★"
 
t[#t+1] = "★★★★"
 
t[#t+1] = "★★★"
 
t[#t+1] = "★★"
 
t[#t+1] = "★"
 
t[#t+1] = "</poll>"
 
t[#t+1] = "</poll>"
 
t[#t+1] = "</div>"
 
t[#t+1] = "</div>"

Latest revision as of 00:56, 4 December 2015

Documentation for this module may be created at Module:Poll/doc

--
-- This module implements {{StarPoll}}
--
 
local p = {}

function p.starPoll(frame)
    local args = frame.args
    local pArgs = frame:getParent().args
    
    local pollName = args[1] or pArgs[1] or "Example"
    
    local t = {}
    t[#t+1] = "<h2 id='starRatingPollHeading'>Game Rating</h2>"
    t[#t+1] = "<div id='starRatingPollCont'>"
    t[#t+1] = "<poll>"
    t[#t+1] = pollName .. " Rating"
    t[#t+1] = "★★★★★"
    t[#t+1] = "★★★★"
    t[#t+1] = "★★★"
    t[#t+1] = "★★"
    t[#t+1] = "★"
    t[#t+1] = "</poll>"
    t[#t+1] = "</div>"
    
    return frame:preprocess( table.concat(t,"\n") )
end
 
return p