Extension talk:Wikibase Client/Lua

mw.wikibase.getEntity
Is it possible to pass id to this function in order to get any entity? --DixonD (talk) 20:57, 27 March 2013 (UTC)
 * It is not possible yet. --Lydia Pintscher (WMDE) (talk) 10:54, 28 March 2013 (UTC)
 * Is it intentionally restricted or not? Bennylin (talk) 16:46, 18 September 2013 (UTC)
 * Look at the bug-49805 to develop. --Rical (talk) 23:58, 18 September 2013 (UTC)

Change Jens Ohlig's code at https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/client/resources/mw.wikibase.lua

from to I think this would work. Bennylin (talk) 18:19, 23 September 2013 (UTC)


 * I first answer on the bug-49805. Then I see your edit here. Very interesting, thanks. But probably with another function name like wikibase.get_Entity to not disturb the original Scribunto, and to test comparing the two fonctions. How to try it, because here I'm not admin, only in fr.wikisource. --Rical (talk) 22:58, 23 September 2013 (UTC)

Troble while accessing personalia
I've written w:ru:Module:Wikibase but met a strange problem. If I try to write construction on any page having facts on Wikidata (Moscow, Mars, arctic fox), I get a pretty table. But on any personalia page (Jimbo, ru:Цзэн Чэн, Ossie Davis) I get only an error on line 51 of mw.wikibase.lua (attempts to index sitelinks which is nil). What to do? Ignatus (talk) 21:23, 3 April 2013 (UTC)
 * This is indeed a strange error. The sitelinks returned are definitely not nil on the items you gave as an example. A first glance at the code of the module you wrote didn't show anything unusual. Does the error persist? --Jens Ohlig (talk) 13:18, 5 April 2013 (UTC)
 * Yes, it's still an error with comment . Ah, I've got what causes this error: it's while trying to get   (male sex for humans, has no sitelinks). The function should be fixed to return nil silently in such cases, I believe. Ignatus (talk) 18:54, 6 April 2013 (UTC)
 * You are correct. I will commit a patch to solve this. Thanks for the error report! --Jens Ohlig (talk) 01:43, 7 April 2013 (UTC)
 * The patch now awaits approval at Gerrit Code Review--Jens Ohlig (talk) 01:54, 7 April 2013 (UTC)
 * And abandoned the patch. User:Tpt offered a better solution which I just merged. --Jens Ohlig (talk) 11:00, 8 April 2013 (UTC)
 * I've rewritten the module to catch it with pcall, now it works on all known pages. Ignatus (talk) 19:31, 6 April 2013 (UTC)
 * And if the identifier is not  (e.g.  ), module raises an error which is uncatchable; I think it also should be somehow moderated. Ignatus (talk) 19:18, 6 April 2013 (UTC)
 * I clarified this in the documentation. Thanks again. --Jens Ohlig (talk) 02:14, 7 April 2013 (UTC)


 * This issue has been raised 30/3 by User:Tpt who issued a patch here https://gerrit.wikimedia.org/r/#/c/56737/ HenkvD (talk) 17:27, 7 April 2013 (UTC)
 * Merged it. --Jens Ohlig (talk) 11:00, 8 April 2013 (UTC)

Hopes for getEntity and getProperty

 * Now, Lua calls to wikibase give many Script Errors. In this module, used in this page, I wrote the function wikidata. But better not blocking error messages could be usefull for many users.
 * To never receive Script Errors, I use :

local dat = wd.entity.claims if dat.p18 then wd.image = dat.p18[0].mainsnak.datavalue.value end -- (because dat["p18"][0] do not works)
 * Like DixonD upper, I hope  and
 * Even exactly  which return a string or nil, and where the element code is not necessary inside a page-element, but where it permits to document the module or the templates elsewhere out of main space, and to build genealogies or species classifications.
 * Now Lua modules work in fr.wikisource, but  do not works. Thanks for a better future. --Rical (talk) 16:02, 13 June 2013 (UTC)

Array numbering
In the examples, it is traditionaly for Lua from 1, but really, since I know, it's from 0. Ignatus (talk) 10:09, 20 July 2013 (UTC)