Module:Scripts/doc: Difference between revisions
Appearance
Content deleted Content added
Alexis Jazz (talk | contribs) ←Created page with '{{Module rating|<!-- Values: pre-alpha • alpha • beta • release • protected • semiprotected -- If a rating not needed/relevant, delete this template call -->}} <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> == Usage == <code><nowiki>{{</nowiki>#invoke:{{subst:BASEPAGENAME}}|''function_name''<nowiki>}}</nowiki></code> <includeonly>{{Sandbox other|| <!-- Categories below this line; interwikis at Wik...' |
Alexis Jazz (talk | contribs) copied from wikt:en:Module:scripts/documentation [Factotum] |
||
Line 1: | Line 1: | ||
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. |
|||
{{Module rating|<!-- Values: pre-alpha • alpha • beta • release • protected • semiprotected -- If a rating not needed/relevant, delete this template call -->}} |
|||
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> |
|||
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. |
|||
== Usage == |
|||
<code><nowiki>{{</nowiki>#invoke:Scripts|''function_name''<nowiki>}}</nowiki></code> |
|||
For functions that allow templates to use this module, see [[Module:scripts/templates]]. |
|||
⚫ | |||
<!-- Categories below this line; interwikis at Wikidata --> |
|||
==Finding and retrieving scripts== |
|||
⚫ | |||
The module exports a number of functions that are used to find scripts. |
|||
{{module documentation|identifier=^export|section_level=3}} |
|||
==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: |
|||
<syntaxhighlight lang="lua"> |
|||
local m_scripts = require("Module:scripts") |
|||
local sc = m_scripts.getByCode("Latn") |
|||
local name = sc:getCanonicalName() |
|||
-- "name" will now be "Latin" |
|||
</syntaxhighlight> |
|||
{{module documentation|identifier=^Script|section_level=3}} |
|||
==Subpages== |
|||
{{subpages|Module:scripts}} |
|||
==See also== |
|||
* [[Module:script utilities]] |
|||
⚫ | |||
[[Category:General utility modules]] |
|||
[[Category:Language and script modules]] |
|||
[[af:Module:Skripte]] |
|||
⚫ |
Revision as of 09:48, 24 November 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.
Script objects
A lua
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 lua
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
See also