8,756
edits
No edit summary |
(should probably work now) |
||
Line 34: | Line 34: | ||
end | end | ||
local ret = {} | local ret = {} | ||
for m in | for m in p.gsplit(text, pattern, plain) do | ||
ret[#ret+1] = m | ret[#ret+1] = m | ||
end | end | ||
Line 72: | Line 72: | ||
end | end | ||
--format table. | |||
local finalTable = {} | local finalTable = {} | ||
for i, row in ipairs( | local str = '' | ||
for i, row in ipairs(result) do | |||
finalTable[i]={} | |||
if row["table"] == 'none' then | |||
if row["item"] == 'none' then | |||
error('A table or item must be specified!') | |||
else | |||
finalTable[i]['item'] = '[[' .. row['item'] .. ']]' | |||
end | |||
elseif row["item"] == 'none' then | |||
finalTable[i]['item'] = 'Item from [[EncounterTable:' .. row['table'] .. '|' .. row['table'] .. ']]' | |||
else | |||
error('What') | |||
finalTable['quantity'] = frame:expandTemplate{title='Dice tooltip', args={row['quantity']}} | end | ||
finalTable['weight'] = row['weight'] | -- dice tooltip quantity | ||
finalTable[i]['quantity'] = frame:expandTemplate{title='Dice tooltip', args={row['quantity']}} | |||
--finalTable[i]['quantity'] = row['quantity'] | |||
finalTable[i]['weight'] = row['weight'] | |||
-- calculate final chance | -- calculate final chance | ||
finalTable['chance'] = row['weight']/totalWeight | finalTable[i]['chance'] = row['weight']/totalWeight | ||
end | end | ||
return (p.formatTable(finalTable)) | |||
end | end | ||