luamediawikiwikipediawikidata-apiwikibase

I have a Script error in Miraheze, I want to try to index the field 'wikibase' (a null value)


I have imported to my Miraheze site the es.Wikipedia Módulo:Ficha but I get this error:

Lua error on line 567: attempt to index field 'wikibase' (a nil value).

Reverse trace:

Module:File:567: in the "makeWikidataBar" function Module:File:638: ? (tail call): ? mw.lua:527: ? [C]: ?

In line 567 I have this code: (Spanish)=local function hacerBarraWikidata(nule)-- Crea en la parte inferior un enlace al ítem de Wikidata (English)=local function makeWikidataBar(nule)-- Creates a link to the Wikidata item at the bottom

In line 638 I have this code: (Spanish)=hacerBarraWikidata() (English)=makeWikidataBar()

Esperaria un resultado que me ayude a finalizar mi módulo de ficha ya que me urge terminarlo llego más de 3 días intentandolo, pero no lo eh conseguido.


Solution

  • Line 567 of https://es.wikipedia.org/wiki/M%C3%B3dulo:Ficha?oldid=155034254 is local entidad = args.entidad or mw.wikibase.getEntityIdForCurrentPage(). The problem is that mw.wikibase is undefined on your wiki, probably because your Miraheze wiki doesn't have https://www.mediawiki.org/wiki/Extension:Wikibase_Client enabled. https://meta.miraheze.org/wiki/Extensions says that extension is available, so one way of fixing this would be to enable it at Special:ManageWiki/extensions on your wiki. Your other option is to remove the call to hacerBarraWikidata() on line 638, since it's the only function that references mw.wikibase, and without that it doesn't have anything useful to do.