GalleryPreview is a module that generates a brief gallery preview onto an article page from a designated gallery page.


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:GalleryPreview in your wiki and add the following code:
--This loads modules directly from
return require("Dev:GalleryPreview")

Using Module:GalleryPreview in another wiki

To use modules without depending on dev see this page. Create Template:GalleryPreview in your wiki and add the following code:

Using template in a page

You can use this module in a page using syntax such as:

Module information



Creates a metatable wrapper for checking arguments.
frArgstableThe arguments table from a frame object. (i.e. frame.args).
Return typeReturn purpose
table"Wrapped" table. Arguments my be indexed with membership operator.


It is suggested that GalleryPreview is invoked through a template.

The generated gallery may be configured similarly to galleries. These setting customizations must be passed through the settings parameter in the following format:

option1: "value",
option2: "value2"



Link to a page's associated gallery page. Should not be enclosed by brackets.
The number of images to select randomly and include in the generated gallery. If this number exceeds the number of images on the gallery page, the generated gallery will include all images from the gallery page.


The text to be shown if gallery_page links to a non-existent page. If not provided, the module has its own built-in default.
"Portal" image to include in the generated gallery that will link to gallery_page. This will be the last image in the generated gallery, and is counted towards the number_of_images limit.
If any value is passed through this parameter, images on the generated gallery will retain their associated caption from the source gallery. By default, captions are not included.
Gallery customization pairs formatted as option: "value". See #Usage above. By default, the gallery is formatted to be centered, navigation set to true, and to exclude the "add to gallery" button.


This example generates a gallery from images in Global Lua Modules/GalleryPreview/Gallery testing.
| gallery_page = {{FULLPAGENAME}}/Gallery testing
| number_of_images = 3
| default = Whelp, looks like the testing page was deleted.
| include_caption = y
| settings =
    bordersize: "medium"


| gallery_page = Some non-existent page
| number_of_images = 5


No gallery for Global Lua Modules/GalleryPreview exists yet! You can create it here.