Module:Lorebook/Debug: Difference between revisions

Add debug output to list all keys in row table to identify correct property key names
Fix mw.smw.ask usage - use array format with printouts as '?Property=label'
Line 84: Line 84:


local function getAllConcepts(world)
local function getAllConcepts(world)
   local query = string.format('[[Category:Concept]][[Belongs to world::%s]]', world)
   local query = {
  local res = mw.smw.ask(query, {
    '[[Category:Concept]][[Belongs to world::' .. world .. ']]',
     ['?Plist'] = 'plist',
     '?Plist=plist',
     ['?AliChat'] = 'alichat',
     '?AliChat=alichat',
     ['?Primary keys'] = 'primary',
     '?Primary keys=primary',
     ['?Secondary keys'] = 'secondary',
     '?Secondary keys=secondary',
     ['?Logic'] = 'logic',
     '?Logic=logic',
     ['?Key mode'] = 'mode',
     '?Key mode=mode',
     ['?Parent concept'] = 'parent',
     '?Parent concept=parent',
     ['?Non-recursable'] = 'nonrec',
     '?Non-recursable=nonrec',
     ['?Placement'] = 'placement',
     '?Placement=placement',
     limit = 999
     limit = 999
   })
   }
 
  local res = mw.smw.ask(query)
    
    
   if not res then return {} end
   if not res then return {} end
Line 119: Line 121:
      
      
     normalized[i] = {
     normalized[i] = {
       page = normalizeValue(row[1]),  -- First element is the page title when mainlabel is not '-'
       page = normalizeValue(row[1]),  -- First element is the page title
       plist = normalizeValue(row.plist),
       plist = normalizeValue(row.plist),
       alichat = normalizeValue(row.alichat),
       alichat = normalizeValue(row.alichat),