Module:EncounterTable: Difference between revisions

209 bytes added ,  03:48, 20 November 2021
try to fix bug w plantsummoning table
m (further reformatting)
(try to fix bug w plantsummoning table)
Line 18: Line 18:
     local tblName = args.name or ''
     local tblName = args.name or ''
     local pick = args.roll or 'once'
     local pick = args.roll or 'once'
    local bSamePageLink = false
    if args.samepage == 'yes' then bSamePageLink = true end
     local result = {}
     local result = {}
     local totalWeight = 0
     local totalWeight = 0
Line 44: Line 46:
             local linkstr = ''
             local linkstr = ''
             maintable = row.table:match'^(.+)%s+%w*$'
             maintable = row.table:match'^(.+)%s+%w*$'
 
            if bSamePageLink then
                maintable = mw.title.getCurrentTitle().prefixedText
            end
             if maintable ~= nil and maintable ~= '' then
             if maintable ~= nil and maintable ~= '' then
                 linkstr = maintable .. '#' .. row.table
                 linkstr = maintable .. '#' .. row.table