Jump to content

Module:Scripts/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
That template doesn't exist yet
Script objects: fix syntaxhighlight errors
 
Line 13: Line 13:
==Script objects==
==Script objects==


A {{code|lua|Script}} object is returned from one of the functions above. It is a Lua representation of a script and the data associated with it. It has a number of methods that can be called on it, using the {{code|lua|:}} syntax. For example:
A {{mono|Script}} object is returned from one of the functions above. It is a Lua representation of a script and the data associated with it. It has a number of methods that can be called on it, using the {{char|:}} syntax. For example:


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 24: Line 24:
{{module documentation|identifier=^Script|section_level=3}}
{{module documentation|identifier=^Script|section_level=3}}
-->
-->

==Subpages==
==Subpages==
{{subpages|Module:scripts}}
{{subpages|Module:scripts}}

Latest revision as of 05:58, 4 April 2024

This module is used to retrieve and manage Wiktionary's various writing systems and the information associated with them. See Wiktionary:Scripts for more information.

The information itself is stored in Module:scripts/data. The data module should not be used directly by any other module, the data should only be accessed through the functions provided by Module:scripts.

For functions that allow templates to use this module, see Module:scripts/templates.

Finding and retrieving scripts

[edit]

The module exports a number of functions that are used to find scripts.

Script objects

[edit]

A Script object is returned from one of the functions above. It is a Lua representation of a script and the data associated with it. It has a number of methods that can be called on it, using the : syntax. For example:

local m_scripts = require("Module:scripts")
local sc = m_scripts.getByCode("Latn")
local name = sc:getCanonicalName()
-- "name" will now be "Latin"

Subpages

[edit]

Module:scripts

See also

[edit]