Module:GetRandomCreature: Difference between revisions

Jump to navigation Jump to search
title returns link to page
mNo edit summary
(title returns link to page)
Line 92: Line 92:
   local offsetin = math.random(0 , tonumber(count))
   local offsetin = math.random(0 , tonumber(count))
   local tables = 'Characters=C, GeneralData=GD'
   local tables = 'Characters=C, GeneralData=GD'
   local fields = 'GD.PlainName=Name'
   local fields = 'GD.PlainName=Name, GD._pageName=Page'
   local args ={join='C._pageName=GD._pageName', where='GD._pageNamespace="0" AND GD.Categories <> "Walls"', offset=offsetin,limit = 1}
   local args ={join='C._pageName=GD._pageName', where='GD._pageNamespace="0" AND GD.Categories <> "Walls"', offset=offsetin,limit = 1}
   local result = cargo.query(tables, fields, args)
   local result = cargo.query(tables, fields, args)
Line 98: Line 98:
     error('?????')
     error('?????')
   end
   end
   return result[1]['Name']
   return '[[' .. result[1]['Page'] .. '|'.. result[1]['Name'] .. ']]'
end
end


Navigation menu