Module:Scripts/documentation: Difference between revisions
Djpwikiadmin (talk | contribs) m (Djpwikiadmin moved page Module:Scripts/doc to Module:Scripts/documentation) |
Djpwikiadmin (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
The module exports a number of functions that are used to find scripts. | The module exports a number of functions that are used to find scripts. | ||
{{module documentation|identifier=^export|section_level=3}} | |||
{{ | |||
= | |||
==Script objects== | ==Script objects== | ||
Line 23: | Line 15: | ||
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 {{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: | ||
< | <syntaxhighlight lang="lua"> | ||
local m_scripts = require("Module:scripts") | local m_scripts = require("Module:scripts") | ||
local sc = m_scripts.getByCode("Latn") | local sc = m_scripts.getByCode("Latn") | ||
local name = sc:getCanonicalName() | local name = sc:getCanonicalName() | ||
-- "name" will now be "Latin" | -- "name" will now be "Latin" | ||
</ | </syntaxhighlight> | ||
{{module documentation|identifier=^Script|section_level=3}} | |||
{{ | |||
==Subpages== | ==Subpages== | ||
Line 88: | Line 32: | ||
<includeonly> | <includeonly> | ||
[[Category:General utility modules]] | [[Category:General utility modules]] | ||
[[Category: | [[Category:Language and script modules]] | ||
[[Category:Wiktionary modules]] | |||
[[ | |||
</includeonly> | </includeonly> |
Latest revision as of 20:51, 18 September 2023
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
The module exports a number of functions that are used to find scripts.
(The generated documentation is located at the module page.)
Script objects
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"
(The generated documentation is located at the module page.)
Subpages
See also