Fandom

Wikia Developers Wiki

Global Lua Modules/Links

< Global Lua Modules

889pages on
this wiki
Add New Page
Talk0 Share

Creates links and changes wikitext when it detects external links.



Install

Installing modules

To get a brief introduction to lua read the basics page first. On Wikia, one can use modules by either accessing a module remotely or copying all its contents to a Wiki. Modules accessed remotely from dev.wikia are subject to change while 'correctly' copied modules are controlled by a particular wiki.

Using a module "remotely" using Module:Devmodule

Create Module:Devmodule and copy the following code to remotely access modules in dev's repository. See more details in Global Lua Modules/Devmodule.
--[[This imports modules from dev.wikia]]
return require("Dev:Devmodule")

Loading modules remotely from dev.wikia

Create Module:Links in your wiki and add the following code:
--This loads modules directly from dev.wikia.com
return require("Dev:Links")

Using Module:Links in another wiki

To use modules without depending on dev see this page. Create Template:Links in your wiki and add the following code:
{{#invoke:Links|main}}

Using template in a page

You can use this module in a page using syntax such as:
{{Links|main|arg1|arg2}}

Module information

Functions

p.link

This function generates a wiki link..
Parameters
NameTypepurpose
urlstringThe url to convert to wikitext.
descstringThe caption or description of the url.
typstringThe type of link, (local or ext).
Return typeReturn purpose
stringA formated wikilink.

p.main

Entry point for function that generates a wiki link..
Parameters
NameTypepurpose
frametableContains frame from invoked module.
Return typeReturn purpose
stringA formated wikilink.

p.batch

Entry point for function that generates several wiki links..
Parameters
NameTypepurpose
frametableContains frame from invoked module.
Return typeReturn purpose
stringA formated string containing one or more wikilinks.

p.createLinkBatch

This creates and formats many links..
Parameters
NameTypepurpose
linkstablea table containing links, e.g. {'Lua label1 type', 'www.google.com google ext'}.
separatorstringa separator between each link.
delimiterstringan optional delimiter that will separate the label, link & type.
Return typeReturn purpose
stringA formated string containing one or more wikilinks.

Syntax

Creating a simple link

{#invoke:links|main|page|label|type=<ext>}}

Creating a batch of links

{#invoke:links|batch|page/url label type
|page1 label1 type1
|page2 label2 type2
|separator = separatortext
|delimiter = delimitertext}}

Parameter description

  • Page (mandatory) = url, e.g. http://google.com or Lua .
  • label (optional)= label for the link
  • type (optional)= "ext" for external links

Examples

 {{#invoke:links|main|wikia.com|wikia|type=ext}}

wikia
 {{#invoke:links|main|Lua}}

Lua
{{#invoke:links|main|http://wikipedia.org}}

[1]
{{#invoke:links|batch|http://wikipedia.org > wiki|luamods > List of Lua Modules|delimiter=>}}

wiki List of Lua Modules

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.