Difference between revisions of "Module:sandbox/getProps"

From Rhizome Artbase
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
--can't get this mw.wikibase function to work.
 +
--created Template:sandbox/getProps
 +
--error: Lua error in Module:sandbox/getProps at line 6: attempt to call method 'getProperties' (a nil value).
 +
--Is this because I need to add the mw.wikibase.entity?
 +
--had same problem with: mw.wikibase.resolvePropertyId, now in Module:sandbox/wikibase
 +
--https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua#
 +
 
local p = {}
 
local p = {}
  
 
function p.getProps(frame)
 
function p.getProps(frame)
     return mw.wikibase.entity:getProperties ('Q4896')
+
     for item_num = 4930,4940 do
 +
        local item_id = "Q" .. item_num
 +
        local props = mw.wikibase.entity:getProperties ( item_id )
 +
        if props == nil then
 +
            props = ""
 +
            end
 
     end
 
     end
   
+
return props
 +
end
 
return p
 
return p

Latest revision as of 02:10, 9 May 2016

Documentation for this module may be created at Module:sandbox/getProps/doc

--can't get this mw.wikibase function to work. 
--created Template:sandbox/getProps
--error: Lua error in Module:sandbox/getProps at line 6: attempt to call method 'getProperties' (a nil value).
--Is this because I need to add the mw.wikibase.entity? 
--had same problem with: mw.wikibase.resolvePropertyId, now in Module:sandbox/wikibase
--https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua#

local p = {}

function p.getProps(frame)
    for item_num = 4930,4940 do
        local item_id = "Q" .. item_num
        local props = mw.wikibase.entity:getProperties ( item_id )
        if props == nil then 
            props = ""
            end
    end
return props
end
return p