Module:Prayer: Difference between revisions

Overload p.getPrayerTable to allow for passing in a predicate
(Use printError function)
(Overload p.getPrayerTable to allow for passing in a predicate)
Line 131: Line 131:


function p.getPrayerTable(frame)
function p.getPrayerTable(frame)
return p.getPrayerTable(frame, function(prayer) return true end)
end
function p.getPrayerTable(frame, prayerPredicate)
local result = '{| class="wikitable sortable stickyHeader"'
local result = '{| class="wikitable sortable stickyHeader"'
result = result..'\r\n|-class=headerRow-0'
result = result..'\r\n|-class=headerRow-0'
Line 136: Line 140:
result = result..'!!Effects!!Point Cost'
result = result..'!!Effects!!Point Cost'


local prayerList = p.getPrayers(function(prayer) return true end)
local prayerList = p.getPrayers(prayerPredicate)
table.sort(prayerList, function(a, b)
table.sort(prayerList, function(a, b)
if a.level == b.level then
if a.level == b.level then
48

edits