Difference between revisions of "Module:Sandbox/RexxS/Iscountry/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>RexxS
(Creating Module:Sandbox/RexxS/Iscountry/doc)
 
blackwiki>RexxS
(→‎Usage: examples)
Line 6: Line 6:
  
 
== Usage ==
 
== Usage ==
 +
 +
From wiki-text:
 +
*<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|iscountry |qid=''entity-id''}}</code>
 +
 +
From another module:
 +
<syntaxhighlight lang="lua">
 +
local iscountry = require("Module:Sandbox/RexxS/Iscountry)._iscountry"
 +
if iscountry(qid) then
 +
    ...
 +
end
 +
</syntaxhighlight>
 +
 +
== Examples ==
  
 
For {{q|Q12130}}
 
For {{q|Q12130}}
* {{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q12130}}
+
* <code><nowiki>{{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q12130}}</nowiki></code> → {{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q12130}}
  
 
For {{q|Q142}}
 
For {{q|Q142}}
* {{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q142}}
+
* <code><nowiki>{{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q142}}</nowiki></code> {{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q142}}
 
 
 
 
<code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''function_name''}}</code>
 
  
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |

Revision as of 21:07, 27 August 2020

{{Module rating }} Demo routine to determine whether a Wikidata entity is a country.

It takes an entity-id as the parameter |qid=.

Usage

From wiki-text:

  • {{#invoke:Sandbox/RexxS/Iscountry|iscountry |qid=entity-id}}

From another module:

local iscountry = require("Module:Sandbox/RexxS/Iscountry)._iscountry"
if iscountry(qid) then
    ...
end

Examples

For Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q12130)

  • {{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q12130}}Lua error in Module:Sandbox/RexxS/Iscountry at line 59: attempt to index field 'wikibase' (a nil value).

For Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q142)

  • {{#invoke:Sandbox/RexxS/Iscountry |iscountry |qid=Q142}}Lua error in Module:Sandbox/RexxS/Iscountry at line 59: attempt to index field 'wikibase' (a nil value).