The purpose of the proposed task is to simplify for Lua coders the use of wikibase. Otherwise, they could search and test for days or weeks.
This property function gets the sought property from any available element and language and returns its value if available.
Otherwise, as usual in scribunto, it returns zero and the module displays an error or changes the requested language...
The simplest use is to request only the property keyword like "image" or "lastname"...
This function gets also pseudo properties: "description", "label", "title", "QITEM" like "Q34743", and "sitelink" like "Author:Rudyard Kipling".
The QITEM argument can be the id like "Q535" or the title or the label of another sought item. "Q" asks the property for the current page.
The value of the default property is returned in the content of the calling page. The module can request it in any language.
For a value in the content or page or language of the user, use "content" or "page" or "user".
For simplicity of use, the module can request languages in descending priority in 2 formats: "user; content; en, de, es" or {'user', 'content', 'en', 'de', ' es',}
Examples:
local prop1 = mw.wikibase.property('P21') -- Simplest use local prop2 = mw.wikibase.property('lastname') -- Named pseudo property local prop3 = mw.wikibase.property('label', 'Q', { 'user', 'page', 'content', 'en', 'de', 'es', } ) -- Default values local prop4 = mw.wikibase.property('description', 'Nelson Mandela', { 'user', 'fr', } ) -- other case