Wikipedia suwiki https://su.wikipedia.org/wiki/Tepas MediaWiki 1.47.0-wmf.16 first-letter Média Husus Obrolan Pamaké Obrolan pamaké Wikipedia Obrolan Wikipedia Gambar Obrolan gambar MédiaWiki Obrolan MédiaWiki Citakan Obrolan citakan Pitulung Obrolan pitulung Kategori Obrolan kategori Portal Obrolan portal TimedText TimedText talk Modul Pembicaraan Modul Acara Pembicaraan Acara Wikipedia:Lua 4 41001 712178 712163 2026-08-21T18:40:16Z Nimmzo 37272 /* Using arguments */ Replaced the horizontal layout (bullet + Lua module invocation + arrow → result) with a vertical layout (the result is placed below the call and vertically aligned). The implicit “Klik Témbongkeun sawangan.” is no longer mentioned to simplify the text. 712178 wikitext text/x-wiki {{tarjamahkeun|Inggris}} {{WikiProject Lua/header}} {{Information page|WP:Lua}} {{Namespaces}} Lua mangrupakeun basa pamrograman nu ayeuna geus sadia di Wikipedia Sunda ngaliwatan ekstensi MediaWiki [[mw:Extension:Scribunto|Scribunto]].<br /> Kode Lua ayeuna bisa diasupkeun kana témplat wiki ku maké fungsi parser <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight> dina kaca pamaké anjeun. == Halo, dunya! dina Lua == The Lua source code is stored in a wiki page with the prefix <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight> (e.g., [[Modul:Bananas]]). These individual modules are then invoked (by code <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight>) on another wiki page (e.g., [[Modul:Bananas/doc]] uses the code <syntaxhighlight lang="lua" inline>{{#invoke:Bananas|hello}}</syntaxhighlight> to print the text <syntaxhighlight lang="lua" inline>"Hello, world!"</syntaxhighlight>). Modules are run on normal wiki pages using the <code>#invoke</code> parser function. The syntax of <code>#invoke</code> is similar to template syntax, but with some differences. The most important difference is that you need to specify a ''function name''. A function is a set of Lua instructions that takes input values, processes them, and returns an output value.<ref>You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.</ref> This is much like what a template does: you give it arguments, it processes them, and you get a result.<br /> However, you can define many functions in one Lua module, whereas you can only define one template on one page. Furthermore, you can't just run a Lua module directly - you can only run one of the module's functions. The module is just a container for the functions, and doesn't do anything by itself. So there are two reasons that we need to input a function name: # We can't run a module by itself. # Without specifying a function name, Lua will not know which function it is we want to run. Run a module from your user page like this: <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi}} </syntaxhighlight></blockquote> For example, [[Modul:Bananas]] is the simplest possible script, providing a single function with no arguments.<br /> The function is named <code>hello</code> in lowercase. We can run this module in this way. Anjeun teu kudu masang atawa nyimpen nanaon. # Édit kaca pamaké anjeun. # Témpélkeun panggilan di handap ieu dina awal hiji baris anyar dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> {{#invoke:Bananas|hello}} </syntaxhighlight></blockquote> <ol start="3"> <li>Klik <code>Témbongkeun sawangan</code>. Panggilan fungsi <syntaxhighlight lang="lua" inline>hello</syntaxhighlight> dina [[Modul:Bananas]] diganti ku ieu di handap: Halo, dunya!</li> </ol> <blockquote><syntaxhighlight lang="text" line> Hello, world! </syntaxhighlight></blockquote> <ol start="4"> <li>Klik <code style="color:#bf3c2c;>Bolay</code>. Lamun dipenta, klik <code>Tinggalkeun</code>.</li> <li>Kaca pamaké anjeun tetep '''teu''' dirobah.</li> </ol> === Using arguments === Arguments are passed to modules in the same way that they are passed to templates. Note, however, that the text after the first pipe character <code>|</code> is always the function name; the first positional argument is the text after the ''second'' pipe. <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|arguménPosisional1}} </syntaxhighlight></blockquote> For example, another [[Modul:BananasArgs]] demonstrates how to access and use parameters.<br /> The <code>hello</code> function greets different people depending on the first positional argument. It works like this: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </blockquote> ;Named arguments key=value <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|argNgaran1=nilai1|argNgaran2=nilai2}} </syntaxhighlight></blockquote> BananasArgs also has a function named "count_fruit" which uses the named arguments <code>bananas</code> and <code>apples</code> to count the number of bananas and apples we have. It can be run switching the order of the parameters: * <code><nowiki>{{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}}</nowiki></code> &rarr; {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} * <code><nowiki>{{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}}</nowiki></code> &rarr; {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} Most modules will have a documentation page explaining what arguments can be used and what their effects will be. == Request a script == Visit [[:en:Wikipedia talk:Lua]] to request help in writing a Lua script to perform a specific task on Wikipedia or another Wikimedia Foundation project. == History == [[mw:Manual:MediaWiki architecture#Magic words and templates|Sordid history]]. {{tl|qif}}, [[mw:Help:Extension:ParserFunctions|ParserFunctions]], [[mw:Extension:Lua|Lua extension]], wiki scripting language debated (JavaScript v. Lua), [[mw:Extension:WikiScripts]], Tim writes [[mw:Extension:Scribunto|Scribunto]] with initial support for Lua. Discussed for years, Lua was installed in 2012 for testing on [[test2wiki:|test2.wikipedia.org]], with open invitation to all editors to experiment with developing Lua modules. Lua was installed on the English Wikipedia in February 2013, after testing on mediawiki.org and Wikimedia test wikis. == About Lua == :''See also [[:File:WMF Tech Talk 2013-02-28 slides - Scribunto presentation.pdf|Brad Jorsch's short presentation for a basic example of how to convert a wikitext template into a Lua module.]]'' Lua is a [[scripting language]] which can be used to analyze data, calculate expressions, and format results using functions or [[object-oriented programming]]. Although some Lua scripts can be kept simple, for easy understanding, Lua allows complex structures including tables, dynamic functions, and [[associative array]]s where index [[subscript]]s can be words as well as index numbers. Lua also supports [[recursion]] of re-nested functions, so care should be taken to avoid excessive complexity where other users would not understand how to maintain a Lua module. The following is an example of Lua [[source code]] for a [[hello world]] function contained in [[Module:HelloWorld]]: <syntaxhighlight lang="lua"> -- All Lua modules on Wikipedia must begin by defining a variable that will hold their -- externally accessible functions. They can have any name and may also hold data. my_object = {} -- Add a function to the variable. These are callable in Wikipedia via the #invoke command. -- "frame" will contain the data that Wikipedia sends this function when it is called. my_object.hello = function( frame ) -- Declare a local variable and assign data to it. local str = "Hello World!" -- Quit this function and send the information in "str" back to Wikipedia. -- The "print" function is not allowed, so all output is accomplished via -- returning strings in this fashion. return str -- End the function. end -- All modules end by returning the variable containing its functions to Wikipedia. return my_object -- We can now use this module by calling {{#invoke: HelloWorld | hello }}. -- The #invoke command begins with the module's name, in this case "HelloWorld", -- then takes the name of one of its functions as an argument, in this case "hello". </syntaxhighlight> A sample of Lua is highlighted by tag "&lt;source lang="lua">...&lt;/source>" placed around the Lua source code. To view some more complex examples of Lua, see article: "[[Lua (programming language)]]". For instructions on how to use Lua within MediaWiki (and hence Wikipedia), see [[mw:Extension:Scribunto/Lua reference manual]]. == Unit testing == A unit testing framework for Lua scripts on Wikipedia is available at [[Module:UnitTests]]. It allows you to execute your script on a given set of inputs and verify that the expected outputs are produced. Unit tests are especially useful for rapidly detecting regressions, where modifications to a script introduce new problems. By convention, unit tests for a module like [[Module:Bananas]] are placed in [[Module:Bananas/testcases]], and are executed on [[Module talk:Bananas/testcases]] with e.g. <code><nowiki>{{#invoke: Bananas/testcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/testcases]] is below. <syntaxhighlight lang="lua"> -- Unit tests for [[Module:Bananas]]. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') end return p </syntaxhighlight> For a list of all modules using unit tests, see [[Special:Whatlinkshere/Module:UnitTests]]. There's also an alternative unit testing framework [[Special:Whatlinkshere/Module:ScribuntoUnit|in use]] called [[Module:ScribuntoUnit]], that originates from Hungarian Wikipedia. Feature-wise it's very similar to [[Module:UnitTests]], but it has a different coding style, and throws real errors that are trapped using protected calls. It also has a method to compare floats within a given precision. == Wikipedia-specific features == Overall: Lua can only get input as text strings passed to the <code><nowiki>{{#invoke:}}</nowiki></code> and what can be fetched via mw.title.new(...):getContent() and frame:expandTemplate(). Lua output will not be preprocessed unless frame:preprocess() is explicitly called, meaning that template calls, parser functions, etc. in the output will not work correctly. Also, all Lua in the page is limited to 10 seconds CPU time (you can look in the source code of a rendered page to see how long a template or module took to parse). And relative to standard Lua, Scribunto's Lua lacks all sorts of functions (see [[mw:Extension:Scribunto/Lua reference manual#Differences from standard Lua]]). === Lua input limitations === Lua code in Scribunto is only run when the page is being parsed. Therefore, the only user input that Lua can receive is by ''page editing'' - it cannot create a box that calculates the square root of a number you type in, or recalculate a piece of the Mandelbrot set depending on which part of the parent set you click on. The input Lua can receive includes any transcludeable text page on Wikipedia. This does ''not'' include graphics files (not even [[Wikipedia:SVG help|.SVG]] files, although they are actually text, unless you cut and paste it onto a Wiki text page), the list of pages listed in a [[Help:Category|category]], nor the contents of [[Wikipedia:Transclusion#Special pages|non-transcludeable]] [[Help:Special|special pages]]. === Wikitext === Transcluded Wikipedia headers frequently contain a hidden code such as <syntaxhighlight lang="lua" inline>"UNIQ5ae8f2aa414ff233-h-3--QINU"</syntaxhighlight> which may need to be stripped out in order for them to be parsed effectively. <blockquote><syntaxhighlight lang="lua" line highlight=1 copy> print(string.reverse("UNIQ")) -- Urutan sabalikna tina "UNIQ" nyaéta "QINU" </syntaxhighlight></blockquote> <blockquote><syntaxhighlight lang="lua" line start=2> QINU </syntaxhighlight></blockquote> Wikilinks of the type <code><nowiki>[[Wikipedia:Pitulung</nowiki></code>'''<code><nowiki>|</nowiki></code>'''<code><nowiki>]]</nowiki></code> won't work if returned as output - they need to be written explicitly as <syntaxhighlight lang="lua" inline>[[Wikipedia:Pitulung|</syntaxhighlight>'''<code><nowiki>Pitulung</nowiki></code>'''<syntaxhighlight lang="lua" inline>]]</syntaxhighlight>. Other pre-save transforms, such as replacing <code>~~<nowiki/>~~</code> with signatures, will also fail to be processed. Template transclusions, parser function calls, and variable substitutions (i.e. anything with a <code><nowiki>{{...}}</nowiki></code>) will not be processed, nor will tags such as {{tag|ref|o}} or {{tag|nowiki|o}}. == Labeling converted templates == {{lua|Module:Bananas}} Please place the {{tl|lua}} template on the documentation subpage of all templates that use Lua. It will help to better communicate Lua usage and template conversions. {{clear}} == See also == * [[Husus:IndeksAwalan/Modul:]] daptar modul Lua * [[:Kategori:Lua-based templates]] &ndash; l-groups ta templates based kan Lua ; English Wikipedia-specific resources * [[:mw:Manual:Coding conventions/Lua]] &ndash; standards to improve the readability of code through consistency * [[:en:Help:Lua debugging]] &ndash; a how-to guide about debugging Lua modules * [[:en:Module:Sandbox]] provides a pseudo-namespace for experimenting with Lua modules * [[:en:Wikipedia talk:Lua]] &ndash; requests for Lua-based templates or tasks == Notes == {{reflist}} {{WikiProject Lua/header}} [[Category:Wikipedia modules]] 9i8k1t9kf2x96tag1953gytv5u2trr3 712179 712178 2026-08-21T18:50:25Z Nimmzo 37272 /* Using arguments */ In key=value, both are strings. This means that the number of apples in `apples=3` is not the number 3 but the string "3" without quotes. 712179 wikitext text/x-wiki {{tarjamahkeun|Inggris}} {{WikiProject Lua/header}} {{Information page|WP:Lua}} {{Namespaces}} Lua mangrupakeun basa pamrograman nu ayeuna geus sadia di Wikipedia Sunda ngaliwatan ekstensi MediaWiki [[mw:Extension:Scribunto|Scribunto]].<br /> Kode Lua ayeuna bisa diasupkeun kana témplat wiki ku maké fungsi parser <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight> dina kaca pamaké anjeun. == Halo, dunya! dina Lua == The Lua source code is stored in a wiki page with the prefix <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight> (e.g., [[Modul:Bananas]]). These individual modules are then invoked (by code <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight>) on another wiki page (e.g., [[Modul:Bananas/doc]] uses the code <syntaxhighlight lang="lua" inline>{{#invoke:Bananas|hello}}</syntaxhighlight> to print the text <syntaxhighlight lang="lua" inline>"Hello, world!"</syntaxhighlight>). Modules are run on normal wiki pages using the <code>#invoke</code> parser function. The syntax of <code>#invoke</code> is similar to template syntax, but with some differences. The most important difference is that you need to specify a ''function name''. A function is a set of Lua instructions that takes input values, processes them, and returns an output value.<ref>You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.</ref> This is much like what a template does: you give it arguments, it processes them, and you get a result.<br /> However, you can define many functions in one Lua module, whereas you can only define one template on one page. Furthermore, you can't just run a Lua module directly - you can only run one of the module's functions. The module is just a container for the functions, and doesn't do anything by itself. So there are two reasons that we need to input a function name: # We can't run a module by itself. # Without specifying a function name, Lua will not know which function it is we want to run. Run a module from your user page like this: <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi}} </syntaxhighlight></blockquote> For example, [[Modul:Bananas]] is the simplest possible script, providing a single function with no arguments.<br /> The function is named <code>hello</code> in lowercase. We can run this module in this way. Anjeun teu kudu masang atawa nyimpen nanaon. # Édit kaca pamaké anjeun. # Témpélkeun panggilan di handap ieu dina awal hiji baris anyar dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> {{#invoke:Bananas|hello}} </syntaxhighlight></blockquote> <ol start="3"> <li>Klik <code>Témbongkeun sawangan</code>. Panggilan fungsi <syntaxhighlight lang="lua" inline>hello</syntaxhighlight> dina [[Modul:Bananas]] diganti ku ieu di handap: Halo, dunya!</li> </ol> <blockquote><syntaxhighlight lang="text" line> Hello, world! </syntaxhighlight></blockquote> <ol start="4"> <li>Klik <code style="color:#bf3c2c;>Bolay</code>. Lamun dipenta, klik <code>Tinggalkeun</code>.</li> <li>Kaca pamaké anjeun tetep '''teu''' dirobah.</li> </ol> === Using arguments === Arguments are passed to modules in the same way that they are passed to templates. Note, however, that the text after the first pipe character <code>|</code> is always the function name; the first positional argument is the text after the ''second'' pipe. <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|arguménPosisional1}} </syntaxhighlight></blockquote> For example, another [[Modul:BananasArgs]] demonstrates how to access and use parameters.<br /> The <code>hello</code> function greets different people depending on the first positional argument. It works like this: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </blockquote> ;Named arguments key=value <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|argNgaran1=nilai1|argNgaran2=nilai2}} </syntaxhighlight></blockquote> The <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight>BananasArgs also has a function named <code>count_fruit</code> which uses the named arguments <code>bananas</code> and <code>apples</code> to count the number of bananas and apples we have. It can be run switching the order of the parameters: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </blockquote> Most modules have a documentation page explaining what arguments can be used and what their effects will be. == Request a script == Visit [[:en:Wikipedia talk:Lua]] to request help in writing a Lua script to perform a specific task on Wikipedia or another Wikimedia Foundation project. == History == [[mw:Manual:MediaWiki architecture#Magic words and templates|Sordid history]]. {{tl|qif}}, [[mw:Help:Extension:ParserFunctions|ParserFunctions]], [[mw:Extension:Lua|Lua extension]], wiki scripting language debated (JavaScript v. Lua), [[mw:Extension:WikiScripts]], Tim writes [[mw:Extension:Scribunto|Scribunto]] with initial support for Lua. Discussed for years, Lua was installed in 2012 for testing on [[test2wiki:|test2.wikipedia.org]], with open invitation to all editors to experiment with developing Lua modules. Lua was installed on the English Wikipedia in February 2013, after testing on mediawiki.org and Wikimedia test wikis. == About Lua == :''See also [[:File:WMF Tech Talk 2013-02-28 slides - Scribunto presentation.pdf|Brad Jorsch's short presentation for a basic example of how to convert a wikitext template into a Lua module.]]'' Lua is a [[scripting language]] which can be used to analyze data, calculate expressions, and format results using functions or [[object-oriented programming]]. Although some Lua scripts can be kept simple, for easy understanding, Lua allows complex structures including tables, dynamic functions, and [[associative array]]s where index [[subscript]]s can be words as well as index numbers. Lua also supports [[recursion]] of re-nested functions, so care should be taken to avoid excessive complexity where other users would not understand how to maintain a Lua module. The following is an example of Lua [[source code]] for a [[hello world]] function contained in [[Module:HelloWorld]]: <syntaxhighlight lang="lua"> -- All Lua modules on Wikipedia must begin by defining a variable that will hold their -- externally accessible functions. They can have any name and may also hold data. my_object = {} -- Add a function to the variable. These are callable in Wikipedia via the #invoke command. -- "frame" will contain the data that Wikipedia sends this function when it is called. my_object.hello = function( frame ) -- Declare a local variable and assign data to it. local str = "Hello World!" -- Quit this function and send the information in "str" back to Wikipedia. -- The "print" function is not allowed, so all output is accomplished via -- returning strings in this fashion. return str -- End the function. end -- All modules end by returning the variable containing its functions to Wikipedia. return my_object -- We can now use this module by calling {{#invoke: HelloWorld | hello }}. -- The #invoke command begins with the module's name, in this case "HelloWorld", -- then takes the name of one of its functions as an argument, in this case "hello". </syntaxhighlight> A sample of Lua is highlighted by tag "&lt;source lang="lua">...&lt;/source>" placed around the Lua source code. To view some more complex examples of Lua, see article: "[[Lua (programming language)]]". For instructions on how to use Lua within MediaWiki (and hence Wikipedia), see [[mw:Extension:Scribunto/Lua reference manual]]. == Unit testing == A unit testing framework for Lua scripts on Wikipedia is available at [[Module:UnitTests]]. It allows you to execute your script on a given set of inputs and verify that the expected outputs are produced. Unit tests are especially useful for rapidly detecting regressions, where modifications to a script introduce new problems. By convention, unit tests for a module like [[Module:Bananas]] are placed in [[Module:Bananas/testcases]], and are executed on [[Module talk:Bananas/testcases]] with e.g. <code><nowiki>{{#invoke: Bananas/testcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/testcases]] is below. <syntaxhighlight lang="lua"> -- Unit tests for [[Module:Bananas]]. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') end return p </syntaxhighlight> For a list of all modules using unit tests, see [[Special:Whatlinkshere/Module:UnitTests]]. There's also an alternative unit testing framework [[Special:Whatlinkshere/Module:ScribuntoUnit|in use]] called [[Module:ScribuntoUnit]], that originates from Hungarian Wikipedia. Feature-wise it's very similar to [[Module:UnitTests]], but it has a different coding style, and throws real errors that are trapped using protected calls. It also has a method to compare floats within a given precision. == Wikipedia-specific features == Overall: Lua can only get input as text strings passed to the <code><nowiki>{{#invoke:}}</nowiki></code> and what can be fetched via mw.title.new(...):getContent() and frame:expandTemplate(). Lua output will not be preprocessed unless frame:preprocess() is explicitly called, meaning that template calls, parser functions, etc. in the output will not work correctly. Also, all Lua in the page is limited to 10 seconds CPU time (you can look in the source code of a rendered page to see how long a template or module took to parse). And relative to standard Lua, Scribunto's Lua lacks all sorts of functions (see [[mw:Extension:Scribunto/Lua reference manual#Differences from standard Lua]]). === Lua input limitations === Lua code in Scribunto is only run when the page is being parsed. Therefore, the only user input that Lua can receive is by ''page editing'' - it cannot create a box that calculates the square root of a number you type in, or recalculate a piece of the Mandelbrot set depending on which part of the parent set you click on. The input Lua can receive includes any transcludeable text page on Wikipedia. This does ''not'' include graphics files (not even [[Wikipedia:SVG help|.SVG]] files, although they are actually text, unless you cut and paste it onto a Wiki text page), the list of pages listed in a [[Help:Category|category]], nor the contents of [[Wikipedia:Transclusion#Special pages|non-transcludeable]] [[Help:Special|special pages]]. === Wikitext === Transcluded Wikipedia headers frequently contain a hidden code such as <syntaxhighlight lang="lua" inline>"UNIQ5ae8f2aa414ff233-h-3--QINU"</syntaxhighlight> which may need to be stripped out in order for them to be parsed effectively. <blockquote><syntaxhighlight lang="lua" line highlight=1 copy> print(string.reverse("UNIQ")) -- Urutan sabalikna tina "UNIQ" nyaéta "QINU" </syntaxhighlight></blockquote> <blockquote><syntaxhighlight lang="lua" line start=2> QINU </syntaxhighlight></blockquote> Wikilinks of the type <code><nowiki>[[Wikipedia:Pitulung</nowiki></code>'''<code><nowiki>|</nowiki></code>'''<code><nowiki>]]</nowiki></code> won't work if returned as output - they need to be written explicitly as <syntaxhighlight lang="lua" inline>[[Wikipedia:Pitulung|</syntaxhighlight>'''<code><nowiki>Pitulung</nowiki></code>'''<syntaxhighlight lang="lua" inline>]]</syntaxhighlight>. Other pre-save transforms, such as replacing <code>~~<nowiki/>~~</code> with signatures, will also fail to be processed. Template transclusions, parser function calls, and variable substitutions (i.e. anything with a <code><nowiki>{{...}}</nowiki></code>) will not be processed, nor will tags such as {{tag|ref|o}} or {{tag|nowiki|o}}. == Labeling converted templates == {{lua|Module:Bananas}} Please place the {{tl|lua}} template on the documentation subpage of all templates that use Lua. It will help to better communicate Lua usage and template conversions. {{clear}} == See also == * [[Husus:IndeksAwalan/Modul:]] daptar modul Lua * [[:Kategori:Lua-based templates]] &ndash; l-groups ta templates based kan Lua ; English Wikipedia-specific resources * [[:mw:Manual:Coding conventions/Lua]] &ndash; standards to improve the readability of code through consistency * [[:en:Help:Lua debugging]] &ndash; a how-to guide about debugging Lua modules * [[:en:Module:Sandbox]] provides a pseudo-namespace for experimenting with Lua modules * [[:en:Wikipedia talk:Lua]] &ndash; requests for Lua-based templates or tasks == Notes == {{reflist}} {{WikiProject Lua/header}} [[Category:Wikipedia modules]] pa9qhoph6e9ur8hragq2osyw2dmaqcc 712180 712179 2026-08-21T19:10:15Z Nimmzo 37272 /* About Lua */ <source lang="lua"> → <syntaxhighlight lang="lua" line highlight=1 copy> When the reader clicks to the "Copy" button, this copies the Lua snippet to the clipboard. Each line is numbered, and line 1 is highlighted. "More complex examples" was removed because they can be added later. Lua (programming language) is this wiki page. 712180 wikitext text/x-wiki {{tarjamahkeun|Inggris}} {{WikiProject Lua/header}} {{Information page|WP:Lua}} {{Namespaces}} Lua mangrupakeun basa pamrograman nu ayeuna geus sadia di Wikipedia Sunda ngaliwatan ekstensi MediaWiki [[mw:Extension:Scribunto|Scribunto]].<br /> Kode Lua ayeuna bisa diasupkeun kana témplat wiki ku maké fungsi parser <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight> dina kaca pamaké anjeun. == Halo, dunya! dina Lua == The Lua source code is stored in a wiki page with the prefix <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight> (e.g., [[Modul:Bananas]]). These individual modules are then invoked (by code <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight>) on another wiki page (e.g., [[Modul:Bananas/doc]] uses the code <syntaxhighlight lang="lua" inline>{{#invoke:Bananas|hello}}</syntaxhighlight> to print the text <syntaxhighlight lang="lua" inline>"Hello, world!"</syntaxhighlight>). Modules are run on normal wiki pages using the <code>#invoke</code> parser function. The syntax of <code>#invoke</code> is similar to template syntax, but with some differences. The most important difference is that you need to specify a ''function name''. A function is a set of Lua instructions that takes input values, processes them, and returns an output value.<ref>You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.</ref> This is much like what a template does: you give it arguments, it processes them, and you get a result.<br /> However, you can define many functions in one Lua module, whereas you can only define one template on one page. Furthermore, you can't just run a Lua module directly - you can only run one of the module's functions. The module is just a container for the functions, and doesn't do anything by itself. So there are two reasons that we need to input a function name: # We can't run a module by itself. # Without specifying a function name, Lua will not know which function it is we want to run. Run a module from your user page like this: <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi}} </syntaxhighlight></blockquote> For example, [[Modul:Bananas]] is the simplest possible script, providing a single function with no arguments.<br /> The function is named <code>hello</code> in lowercase. We can run this module in this way. Anjeun teu kudu masang atawa nyimpen nanaon. # Édit kaca pamaké anjeun. # Témpélkeun panggilan di handap ieu dina awal hiji baris anyar dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> {{#invoke:Bananas|hello}} </syntaxhighlight></blockquote> <ol start="3"> <li>Klik <code>Témbongkeun sawangan</code>. Panggilan fungsi <syntaxhighlight lang="lua" inline>hello</syntaxhighlight> dina [[Modul:Bananas]] diganti ku ieu di handap: Halo, dunya!</li> </ol> <blockquote><syntaxhighlight lang="text" line> Hello, world! </syntaxhighlight></blockquote> <ol start="4"> <li>Klik <code style="color:#bf3c2c;>Bolay</code>. Lamun dipenta, klik <code>Tinggalkeun</code>.</li> <li>Kaca pamaké anjeun tetep '''teu''' dirobah.</li> </ol> === Using arguments === Arguments are passed to modules in the same way that they are passed to templates. Note, however, that the text after the first pipe character <code>|</code> is always the function name; the first positional argument is the text after the ''second'' pipe. <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|arguménPosisional1}} </syntaxhighlight></blockquote> For example, another [[Modul:BananasArgs]] demonstrates how to access and use parameters.<br /> The <code>hello</code> function greets different people depending on the first positional argument. It works like this: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </blockquote> ;Named arguments key=value <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|argNgaran1=nilai1|argNgaran2=nilai2}} </syntaxhighlight></blockquote> The <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight>BananasArgs also has a function named <code>count_fruit</code> which uses the named arguments <code>bananas</code> and <code>apples</code> to count the number of bananas and apples we have. It can be run switching the order of the parameters: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </blockquote> Most modules have a documentation page explaining what arguments can be used and what their effects will be. == Request a script == Visit [[:en:Wikipedia talk:Lua]] to request help in writing a Lua script to perform a specific task on Wikipedia or another Wikimedia Foundation project. == History == [[mw:Manual:MediaWiki architecture#Magic words and templates|Sordid history]]. {{tl|qif}}, [[mw:Help:Extension:ParserFunctions|ParserFunctions]], [[mw:Extension:Lua|Lua extension]], wiki scripting language debated (JavaScript v. Lua), [[mw:Extension:WikiScripts]], Tim writes [[mw:Extension:Scribunto|Scribunto]] with initial support for Lua. Discussed for years, Lua was installed in 2012 for testing on [[test2wiki:|test2.wikipedia.org]], with open invitation to all editors to experiment with developing Lua modules. Lua was installed on the English Wikipedia in February 2013, after testing on mediawiki.org and Wikimedia test wikis. == About Lua == :''See also [[:File:WMF Tech Talk 2013-02-28 slides - Scribunto presentation.pdf|Brad Jorsch's short presentation for a basic example of how to convert a wikitext template into a Lua module.]]'' Lua is a [[scripting language]] which can be used to analyze data, calculate expressions, and format results using functions or [[object-oriented programming]]. Although some Lua scripts can be kept simple, for easy understanding, Lua allows complex structures including tables, dynamic functions, and [[associative array]]s where index [[subscript]]s can be words as well as index numbers. Lua also supports [[recursion]] of re-nested functions, so care should be taken to avoid excessive complexity where other users would not understand how to maintain a Lua module. The following is an example of Lua [[source code]] for a [[hello world]] function contained in [[Module:HelloWorld]]: <syntaxhighlight lang="lua"> -- All Lua modules on Wikipedia must begin by defining a variable that will hold their -- externally accessible functions. They can have any name and may also hold data. my_object = {} -- Add a function to the variable. These are callable in Wikipedia via the #invoke command. -- "frame" will contain the data that Wikipedia sends this function when it is called. my_object.hello = function( frame ) -- Declare a local variable and assign data to it. local str = "Hello World!" -- Quit this function and send the information in "str" back to Wikipedia. -- The "print" function is not allowed, so all output is accomplished via -- returning strings in this fashion. return str -- End the function. end -- All modules end by returning the variable containing its functions to Wikipedia. return my_object -- We can now use this module by calling {{#invoke: HelloWorld | hello }}. -- The #invoke command begins with the module's name, in this case "HelloWorld", -- then takes the name of one of its functions as an argument, in this case "hello". </syntaxhighlight> A sample of Lua is highlighted by tag <code><nowiki><syntaxhighlight lang="lua" line highlight=1 copy> ... </syntaxhighlight></nowiki></code> placed around the Lua source code. For instructions on how to use Lua within MediaWiki (and hence Wikipedia), see [[mw:Extension:Scribunto/Lua reference manual]]. == Unit testing == A unit testing framework for Lua scripts on Wikipedia is available at [[Module:UnitTests]]. It allows you to execute your script on a given set of inputs and verify that the expected outputs are produced. Unit tests are especially useful for rapidly detecting regressions, where modifications to a script introduce new problems. By convention, unit tests for a module like [[Module:Bananas]] are placed in [[Module:Bananas/testcases]], and are executed on [[Module talk:Bananas/testcases]] with e.g. <code><nowiki>{{#invoke: Bananas/testcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/testcases]] is below. <syntaxhighlight lang="lua"> -- Unit tests for [[Module:Bananas]]. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') end return p </syntaxhighlight> For a list of all modules using unit tests, see [[Special:Whatlinkshere/Module:UnitTests]]. There's also an alternative unit testing framework [[Special:Whatlinkshere/Module:ScribuntoUnit|in use]] called [[Module:ScribuntoUnit]], that originates from Hungarian Wikipedia. Feature-wise it's very similar to [[Module:UnitTests]], but it has a different coding style, and throws real errors that are trapped using protected calls. It also has a method to compare floats within a given precision. == Wikipedia-specific features == Overall: Lua can only get input as text strings passed to the <code><nowiki>{{#invoke:}}</nowiki></code> and what can be fetched via mw.title.new(...):getContent() and frame:expandTemplate(). Lua output will not be preprocessed unless frame:preprocess() is explicitly called, meaning that template calls, parser functions, etc. in the output will not work correctly. Also, all Lua in the page is limited to 10 seconds CPU time (you can look in the source code of a rendered page to see how long a template or module took to parse). And relative to standard Lua, Scribunto's Lua lacks all sorts of functions (see [[mw:Extension:Scribunto/Lua reference manual#Differences from standard Lua]]). === Lua input limitations === Lua code in Scribunto is only run when the page is being parsed. Therefore, the only user input that Lua can receive is by ''page editing'' - it cannot create a box that calculates the square root of a number you type in, or recalculate a piece of the Mandelbrot set depending on which part of the parent set you click on. The input Lua can receive includes any transcludeable text page on Wikipedia. This does ''not'' include graphics files (not even [[Wikipedia:SVG help|.SVG]] files, although they are actually text, unless you cut and paste it onto a Wiki text page), the list of pages listed in a [[Help:Category|category]], nor the contents of [[Wikipedia:Transclusion#Special pages|non-transcludeable]] [[Help:Special|special pages]]. === Wikitext === Transcluded Wikipedia headers frequently contain a hidden code such as <syntaxhighlight lang="lua" inline>"UNIQ5ae8f2aa414ff233-h-3--QINU"</syntaxhighlight> which may need to be stripped out in order for them to be parsed effectively. <blockquote><syntaxhighlight lang="lua" line highlight=1 copy> print(string.reverse("UNIQ")) -- Urutan sabalikna tina "UNIQ" nyaéta "QINU" </syntaxhighlight></blockquote> <blockquote><syntaxhighlight lang="lua" line start=2> QINU </syntaxhighlight></blockquote> Wikilinks of the type <code><nowiki>[[Wikipedia:Pitulung</nowiki></code>'''<code><nowiki>|</nowiki></code>'''<code><nowiki>]]</nowiki></code> won't work if returned as output - they need to be written explicitly as <syntaxhighlight lang="lua" inline>[[Wikipedia:Pitulung|</syntaxhighlight>'''<code><nowiki>Pitulung</nowiki></code>'''<syntaxhighlight lang="lua" inline>]]</syntaxhighlight>. Other pre-save transforms, such as replacing <code>~~<nowiki/>~~</code> with signatures, will also fail to be processed. Template transclusions, parser function calls, and variable substitutions (i.e. anything with a <code><nowiki>{{...}}</nowiki></code>) will not be processed, nor will tags such as {{tag|ref|o}} or {{tag|nowiki|o}}. == Labeling converted templates == {{lua|Module:Bananas}} Please place the {{tl|lua}} template on the documentation subpage of all templates that use Lua. It will help to better communicate Lua usage and template conversions. {{clear}} == See also == * [[Husus:IndeksAwalan/Modul:]] daptar modul Lua * [[:Kategori:Lua-based templates]] &ndash; l-groups ta templates based kan Lua ; English Wikipedia-specific resources * [[:mw:Manual:Coding conventions/Lua]] &ndash; standards to improve the readability of code through consistency * [[:en:Help:Lua debugging]] &ndash; a how-to guide about debugging Lua modules * [[:en:Module:Sandbox]] provides a pseudo-namespace for experimenting with Lua modules * [[:en:Wikipedia talk:Lua]] &ndash; requests for Lua-based templates or tasks == Notes == {{reflist}} {{WikiProject Lua/header}} [[Category:Wikipedia modules]] bwu8hdhzq1q924w3641d89ofbqw1laj 712181 712180 2026-08-21T19:20:31Z Nimmzo 37272 /* About Lua */ The red wikilinks are removed (they could be restored when the corresponding wikipages will be created). Replaced Module:HelloWorld with existing [[Modul:Bananas]] called above 712181 wikitext text/x-wiki {{tarjamahkeun|Inggris}} {{WikiProject Lua/header}} {{Information page|WP:Lua}} {{Namespaces}} Lua mangrupakeun basa pamrograman nu ayeuna geus sadia di Wikipedia Sunda ngaliwatan ekstensi MediaWiki [[mw:Extension:Scribunto|Scribunto]].<br /> Kode Lua ayeuna bisa diasupkeun kana témplat wiki ku maké fungsi parser <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight> dina kaca pamaké anjeun. == Halo, dunya! dina Lua == The Lua source code is stored in a wiki page with the prefix <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight> (e.g., [[Modul:Bananas]]). These individual modules are then invoked (by code <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight>) on another wiki page (e.g., [[Modul:Bananas/doc]] uses the code <syntaxhighlight lang="lua" inline>{{#invoke:Bananas|hello}}</syntaxhighlight> to print the text <syntaxhighlight lang="lua" inline>"Hello, world!"</syntaxhighlight>). Modules are run on normal wiki pages using the <code>#invoke</code> parser function. The syntax of <code>#invoke</code> is similar to template syntax, but with some differences. The most important difference is that you need to specify a ''function name''. A function is a set of Lua instructions that takes input values, processes them, and returns an output value.<ref>You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.</ref> This is much like what a template does: you give it arguments, it processes them, and you get a result.<br /> However, you can define many functions in one Lua module, whereas you can only define one template on one page. Furthermore, you can't just run a Lua module directly - you can only run one of the module's functions. The module is just a container for the functions, and doesn't do anything by itself. So there are two reasons that we need to input a function name: # We can't run a module by itself. # Without specifying a function name, Lua will not know which function it is we want to run. Run a module from your user page like this: <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi}} </syntaxhighlight></blockquote> For example, [[Modul:Bananas]] is the simplest possible script, providing a single function with no arguments.<br /> The function is named <code>hello</code> in lowercase. We can run this module in this way. Anjeun teu kudu masang atawa nyimpen nanaon. # Édit kaca pamaké anjeun. # Témpélkeun panggilan di handap ieu dina awal hiji baris anyar dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> {{#invoke:Bananas|hello}} </syntaxhighlight></blockquote> <ol start="3"> <li>Klik <code>Témbongkeun sawangan</code>. Panggilan fungsi <syntaxhighlight lang="lua" inline>hello</syntaxhighlight> dina [[Modul:Bananas]] diganti ku ieu di handap: Halo, dunya!</li> </ol> <blockquote><syntaxhighlight lang="text" line> Hello, world! </syntaxhighlight></blockquote> <ol start="4"> <li>Klik <code style="color:#bf3c2c;>Bolay</code>. Lamun dipenta, klik <code>Tinggalkeun</code>.</li> <li>Kaca pamaké anjeun tetep '''teu''' dirobah.</li> </ol> === Using arguments === Arguments are passed to modules in the same way that they are passed to templates. Note, however, that the text after the first pipe character <code>|</code> is always the function name; the first positional argument is the text after the ''second'' pipe. <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|arguménPosisional1}} </syntaxhighlight></blockquote> For example, another [[Modul:BananasArgs]] demonstrates how to access and use parameters.<br /> The <code>hello</code> function greets different people depending on the first positional argument. It works like this: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </blockquote> ;Named arguments key=value <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|argNgaran1=nilai1|argNgaran2=nilai2}} </syntaxhighlight></blockquote> The <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight>BananasArgs also has a function named <code>count_fruit</code> which uses the named arguments <code>bananas</code> and <code>apples</code> to count the number of bananas and apples we have. It can be run switching the order of the parameters: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </blockquote> Most modules have a documentation page explaining what arguments can be used and what their effects will be. == Request a script == Visit [[:en:Wikipedia talk:Lua]] to request help in writing a Lua script to perform a specific task on Wikipedia or another Wikimedia Foundation project. == History == [[mw:Manual:MediaWiki architecture#Magic words and templates|Sordid history]]. {{tl|qif}}, [[mw:Help:Extension:ParserFunctions|ParserFunctions]], [[mw:Extension:Lua|Lua extension]], wiki scripting language debated (JavaScript v. Lua), [[mw:Extension:WikiScripts]], Tim writes [[mw:Extension:Scribunto|Scribunto]] with initial support for Lua. Discussed for years, Lua was installed in 2012 for testing on [[test2wiki:|test2.wikipedia.org]], with open invitation to all editors to experiment with developing Lua modules. Lua was installed on the English Wikipedia in February 2013, after testing on mediawiki.org and Wikimedia test wikis. == About Lua == :''See also [[:File:WMF Tech Talk 2013-02-28 slides - Scribunto presentation.pdf|Brad Jorsch's short presentation for a basic example of how to convert a wikitext template into a Lua module.]]'' Lua is a scripting language which can be used to analyze data, calculate expressions, and format results using functions or object-oriented programming. Although some Lua scripts can be kept simple, for easy understanding, Lua allows complex structures including tables, dynamic functions, and associative arrays where index subscripts can be words as well as index numbers. Lua also supports recursion of re-nested functions, so care should be taken to avoid excessive complexity where other users would not understand how to maintain a Lua module. The following is an example of Lua source code for the <code>hello</code> function contained in [[Modul:Bananas]]: <syntaxhighlight lang="lua"> -- All Lua modules on Wikipedia must begin by defining a variable that will hold their -- externally accessible functions. They can have any name and may also hold data. my_object = {} -- Add a function to the variable. These are callable in Wikipedia via the #invoke command. -- "frame" will contain the data that Wikipedia sends this function when it is called. my_object.hello = function( frame ) -- Declare a local variable and assign data to it. local str = "Hello World!" -- Quit this function and send the information in "str" back to Wikipedia. -- The "print" function is not allowed, so all output is accomplished via -- returning strings in this fashion. return str -- End the function. end -- All modules end by returning the variable containing its functions to Wikipedia. return my_object -- We can now use this module by calling {{#invoke: HelloWorld | hello }}. -- The #invoke command begins with the module's name, in this case "HelloWorld", -- then takes the name of one of its functions as an argument, in this case "hello". </syntaxhighlight> A sample of Lua is highlighted by tag <code><nowiki><syntaxhighlight lang="lua" line highlight=1 copy> ... </syntaxhighlight></nowiki></code> placed around the Lua source code. For instructions on how to use Lua within MediaWiki (and hence Wikipedia), see [[mw:Extension:Scribunto/Lua reference manual]]. == Unit testing == A unit testing framework for Lua scripts on Wikipedia is available at [[Module:UnitTests]]. It allows you to execute your script on a given set of inputs and verify that the expected outputs are produced. Unit tests are especially useful for rapidly detecting regressions, where modifications to a script introduce new problems. By convention, unit tests for a module like [[Module:Bananas]] are placed in [[Module:Bananas/testcases]], and are executed on [[Module talk:Bananas/testcases]] with e.g. <code><nowiki>{{#invoke: Bananas/testcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/testcases]] is below. <syntaxhighlight lang="lua"> -- Unit tests for [[Module:Bananas]]. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') end return p </syntaxhighlight> For a list of all modules using unit tests, see [[Special:Whatlinkshere/Module:UnitTests]]. There's also an alternative unit testing framework [[Special:Whatlinkshere/Module:ScribuntoUnit|in use]] called [[Module:ScribuntoUnit]], that originates from Hungarian Wikipedia. Feature-wise it's very similar to [[Module:UnitTests]], but it has a different coding style, and throws real errors that are trapped using protected calls. It also has a method to compare floats within a given precision. == Wikipedia-specific features == Overall: Lua can only get input as text strings passed to the <code><nowiki>{{#invoke:}}</nowiki></code> and what can be fetched via mw.title.new(...):getContent() and frame:expandTemplate(). Lua output will not be preprocessed unless frame:preprocess() is explicitly called, meaning that template calls, parser functions, etc. in the output will not work correctly. Also, all Lua in the page is limited to 10 seconds CPU time (you can look in the source code of a rendered page to see how long a template or module took to parse). And relative to standard Lua, Scribunto's Lua lacks all sorts of functions (see [[mw:Extension:Scribunto/Lua reference manual#Differences from standard Lua]]). === Lua input limitations === Lua code in Scribunto is only run when the page is being parsed. Therefore, the only user input that Lua can receive is by ''page editing'' - it cannot create a box that calculates the square root of a number you type in, or recalculate a piece of the Mandelbrot set depending on which part of the parent set you click on. The input Lua can receive includes any transcludeable text page on Wikipedia. This does ''not'' include graphics files (not even [[Wikipedia:SVG help|.SVG]] files, although they are actually text, unless you cut and paste it onto a Wiki text page), the list of pages listed in a [[Help:Category|category]], nor the contents of [[Wikipedia:Transclusion#Special pages|non-transcludeable]] [[Help:Special|special pages]]. === Wikitext === Transcluded Wikipedia headers frequently contain a hidden code such as <syntaxhighlight lang="lua" inline>"UNIQ5ae8f2aa414ff233-h-3--QINU"</syntaxhighlight> which may need to be stripped out in order for them to be parsed effectively. <blockquote><syntaxhighlight lang="lua" line highlight=1 copy> print(string.reverse("UNIQ")) -- Urutan sabalikna tina "UNIQ" nyaéta "QINU" </syntaxhighlight></blockquote> <blockquote><syntaxhighlight lang="lua" line start=2> QINU </syntaxhighlight></blockquote> Wikilinks of the type <code><nowiki>[[Wikipedia:Pitulung</nowiki></code>'''<code><nowiki>|</nowiki></code>'''<code><nowiki>]]</nowiki></code> won't work if returned as output - they need to be written explicitly as <syntaxhighlight lang="lua" inline>[[Wikipedia:Pitulung|</syntaxhighlight>'''<code><nowiki>Pitulung</nowiki></code>'''<syntaxhighlight lang="lua" inline>]]</syntaxhighlight>. Other pre-save transforms, such as replacing <code>~~<nowiki/>~~</code> with signatures, will also fail to be processed. Template transclusions, parser function calls, and variable substitutions (i.e. anything with a <code><nowiki>{{...}}</nowiki></code>) will not be processed, nor will tags such as {{tag|ref|o}} or {{tag|nowiki|o}}. == Labeling converted templates == {{lua|Module:Bananas}} Please place the {{tl|lua}} template on the documentation subpage of all templates that use Lua. It will help to better communicate Lua usage and template conversions. {{clear}} == See also == * [[Husus:IndeksAwalan/Modul:]] daptar modul Lua * [[:Kategori:Lua-based templates]] &ndash; l-groups ta templates based kan Lua ; English Wikipedia-specific resources * [[:mw:Manual:Coding conventions/Lua]] &ndash; standards to improve the readability of code through consistency * [[:en:Help:Lua debugging]] &ndash; a how-to guide about debugging Lua modules * [[:en:Module:Sandbox]] provides a pseudo-namespace for experimenting with Lua modules * [[:en:Wikipedia talk:Lua]] &ndash; requests for Lua-based templates or tasks == Notes == {{reflist}} {{WikiProject Lua/header}} [[Category:Wikipedia modules]] dh655x7xkp3cu9ootnwq7uoyuls5m5l 712182 712181 2026-08-21T20:00:05Z Nimmzo 37272 /* About Lua */ The deleted [[:en:Module:HelloWorld]] example used 25 Lua lines to print the same result as [[Modul:Bananas]], which uses only 6 lines. The 🍌 example is introduced to illustrate "avoid excessive complexity." So let’s avoid the anonymous function on the right side of `=` in `my_object.hello = function( frame )`. Prefer a standard (p)ackage table with the single letter `p` instead of `my_object.hello`. The main comment was missing: `frame` is declared but not used. 712182 wikitext text/x-wiki {{tarjamahkeun|Inggris}} {{WikiProject Lua/header}} {{Information page|WP:Lua}} {{Namespaces}} Lua mangrupakeun basa pamrograman nu ayeuna geus sadia di Wikipedia Sunda ngaliwatan ekstensi MediaWiki [[mw:Extension:Scribunto|Scribunto]].<br /> Kode Lua ayeuna bisa diasupkeun kana témplat wiki ku maké fungsi parser <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight> dina kaca pamaké anjeun. == Halo, dunya! dina Lua == The Lua source code is stored in a wiki page with the prefix <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight> (e.g., [[Modul:Bananas]]). These individual modules are then invoked (by code <syntaxhighlight lang="lua" inline>{{#invoke:}}</syntaxhighlight>) on another wiki page (e.g., [[Modul:Bananas/doc]] uses the code <syntaxhighlight lang="lua" inline>{{#invoke:Bananas|hello}}</syntaxhighlight> to print the text <syntaxhighlight lang="lua" inline>"Hello, world!"</syntaxhighlight>). Modules are run on normal wiki pages using the <code>#invoke</code> parser function. The syntax of <code>#invoke</code> is similar to template syntax, but with some differences. The most important difference is that you need to specify a ''function name''. A function is a set of Lua instructions that takes input values, processes them, and returns an output value.<ref>You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.</ref> This is much like what a template does: you give it arguments, it processes them, and you get a result.<br /> However, you can define many functions in one Lua module, whereas you can only define one template on one page. Furthermore, you can't just run a Lua module directly - you can only run one of the module's functions. The module is just a container for the functions, and doesn't do anything by itself. So there are two reasons that we need to input a function name: # We can't run a module by itself. # Without specifying a function name, Lua will not know which function it is we want to run. Run a module from your user page like this: <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi}} </syntaxhighlight></blockquote> For example, [[Modul:Bananas]] is the simplest possible script, providing a single function with no arguments.<br /> The function is named <code>hello</code> in lowercase. We can run this module in this way. Anjeun teu kudu masang atawa nyimpen nanaon. # Édit kaca pamaké anjeun. # Témpélkeun panggilan di handap ieu dina awal hiji baris anyar dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> {{#invoke:Bananas|hello}} </syntaxhighlight></blockquote> <ol start="3"> <li>Klik <code>Témbongkeun sawangan</code>. Panggilan fungsi <syntaxhighlight lang="lua" inline>hello</syntaxhighlight> dina [[Modul:Bananas]] diganti ku ieu di handap: Halo, dunya!</li> </ol> <blockquote><syntaxhighlight lang="text" line> Hello, world! </syntaxhighlight></blockquote> <ol start="4"> <li>Klik <code style="color:#bf3c2c;>Bolay</code>. Lamun dipenta, klik <code>Tinggalkeun</code>.</li> <li>Kaca pamaké anjeun tetep '''teu''' dirobah.</li> </ol> === Using arguments === Arguments are passed to modules in the same way that they are passed to templates. Note, however, that the text after the first pipe character <code>|</code> is always the function name; the first positional argument is the text after the ''second'' pipe. <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|arguménPosisional1}} </syntaxhighlight></blockquote> For example, another [[Modul:BananasArgs]] demonstrates how to access and use parameters.<br /> The <code>hello</code> function greets different people depending on the first positional argument. It works like this: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|hello|Mariam}} # {{#invoke:BananasArgs|hello|Mohamed}} </blockquote> ;Named arguments key=value <blockquote><syntaxhighlight lang="lua" line> {{#invoke:NgaranModul|ngaranFungsi|argNgaran1=nilai1|argNgaran2=nilai2}} </syntaxhighlight></blockquote> The <syntaxhighlight lang="lua" inline>Modul:</syntaxhighlight>BananasArgs also has a function named <code>count_fruit</code> which uses the named arguments <code>bananas</code> and <code>apples</code> to count the number of bananas and apples we have. It can be run switching the order of the parameters: Dina kaca pamaké anjeun: <blockquote><syntaxhighlight lang="wikitext" line highlight=1 copy> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </syntaxhighlight></blockquote> <blockquote> # {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}} # {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}} </blockquote> Most modules have a documentation page explaining what arguments can be used and what their effects will be. == Request a script == Visit [[:en:Wikipedia talk:Lua]] to request help in writing a Lua script to perform a specific task on Wikipedia or another Wikimedia Foundation project. == History == [[mw:Manual:MediaWiki architecture#Magic words and templates|Sordid history]]. {{tl|qif}}, [[mw:Help:Extension:ParserFunctions|ParserFunctions]], [[mw:Extension:Lua|Lua extension]], wiki scripting language debated (JavaScript v. Lua), [[mw:Extension:WikiScripts]], Tim writes [[mw:Extension:Scribunto|Scribunto]] with initial support for Lua. Discussed for years, Lua was installed in 2012 for testing on [[test2wiki:|test2.wikipedia.org]], with open invitation to all editors to experiment with developing Lua modules. Lua was installed on the English Wikipedia in February 2013, after testing on mediawiki.org and Wikimedia test wikis. == About Lua == :''See also [[:File:WMF Tech Talk 2013-02-28 slides - Scribunto presentation.pdf|Brad Jorsch's short presentation for a basic example of how to convert a wikitext template into a Lua module.]]'' Lua is a scripting language which can be used to analyze data, calculate expressions, and format results using functions or object-oriented programming. Although some Lua scripts can be kept simple, for easy understanding, Lua allows complex structures including tables, dynamic functions, and associative arrays where index subscripts can be words as well as index numbers. Lua also supports recursion of re-nested functions, so care should be taken to avoid excessive complexity where other users would not understand how to maintain a Lua module. The following is an example of Lua source code for the <code>hello</code> function contained in [[Modul:Bananas]]: <syntaxhighlight lang="lua" line highlight=3> --[[Modul:Bananas]]-- local p = {} -- tabel modul nu diperlukeun, diinisialisasi minangka tabel kosong function p.hello() -- Nangtukeun fungsi hello. return "Hello, world!" -- Mulangkeun hasil fungsi dina wangun string. end -- Ahir fungsi. return p -- Mulangkeun tabel modul. </syntaxhighlight> A sample of Lua is highlighted by tag <code><nowiki><syntaxhighlight lang="lua" line highlight=1 copy> ... </syntaxhighlight></nowiki></code> placed around the Lua source code. For instructions on how to use Lua within MediaWiki (and hence Wikipedia), see [[mw:Extension:Scribunto/Lua reference manual]]. == Unit testing == A unit testing framework for Lua scripts on Wikipedia is available at [[Module:UnitTests]]. It allows you to execute your script on a given set of inputs and verify that the expected outputs are produced. Unit tests are especially useful for rapidly detecting regressions, where modifications to a script introduce new problems. By convention, unit tests for a module like [[Module:Bananas]] are placed in [[Module:Bananas/testcases]], and are executed on [[Module talk:Bananas/testcases]] with e.g. <code><nowiki>{{#invoke: Bananas/testcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/testcases]] is below. <syntaxhighlight lang="lua"> -- Unit tests for [[Module:Bananas]]. Click talk page to run tests. local p = require('Module:UnitTests') function p:test_hello() self:preprocess_equals('{{#invoke:Bananas | hello}}', 'Hello, world!') end return p </syntaxhighlight> For a list of all modules using unit tests, see [[Special:Whatlinkshere/Module:UnitTests]]. There's also an alternative unit testing framework [[Special:Whatlinkshere/Module:ScribuntoUnit|in use]] called [[Module:ScribuntoUnit]], that originates from Hungarian Wikipedia. Feature-wise it's very similar to [[Module:UnitTests]], but it has a different coding style, and throws real errors that are trapped using protected calls. It also has a method to compare floats within a given precision. == Wikipedia-specific features == Overall: Lua can only get input as text strings passed to the <code><nowiki>{{#invoke:}}</nowiki></code> and what can be fetched via mw.title.new(...):getContent() and frame:expandTemplate(). Lua output will not be preprocessed unless frame:preprocess() is explicitly called, meaning that template calls, parser functions, etc. in the output will not work correctly. Also, all Lua in the page is limited to 10 seconds CPU time (you can look in the source code of a rendered page to see how long a template or module took to parse). And relative to standard Lua, Scribunto's Lua lacks all sorts of functions (see [[mw:Extension:Scribunto/Lua reference manual#Differences from standard Lua]]). === Lua input limitations === Lua code in Scribunto is only run when the page is being parsed. Therefore, the only user input that Lua can receive is by ''page editing'' - it cannot create a box that calculates the square root of a number you type in, or recalculate a piece of the Mandelbrot set depending on which part of the parent set you click on. The input Lua can receive includes any transcludeable text page on Wikipedia. This does ''not'' include graphics files (not even [[Wikipedia:SVG help|.SVG]] files, although they are actually text, unless you cut and paste it onto a Wiki text page), the list of pages listed in a [[Help:Category|category]], nor the contents of [[Wikipedia:Transclusion#Special pages|non-transcludeable]] [[Help:Special|special pages]]. === Wikitext === Transcluded Wikipedia headers frequently contain a hidden code such as <syntaxhighlight lang="lua" inline>"UNIQ5ae8f2aa414ff233-h-3--QINU"</syntaxhighlight> which may need to be stripped out in order for them to be parsed effectively. <blockquote><syntaxhighlight lang="lua" line highlight=1 copy> print(string.reverse("UNIQ")) -- Urutan sabalikna tina "UNIQ" nyaéta "QINU" </syntaxhighlight></blockquote> <blockquote><syntaxhighlight lang="lua" line start=2> QINU </syntaxhighlight></blockquote> Wikilinks of the type <code><nowiki>[[Wikipedia:Pitulung</nowiki></code>'''<code><nowiki>|</nowiki></code>'''<code><nowiki>]]</nowiki></code> won't work if returned as output - they need to be written explicitly as <syntaxhighlight lang="lua" inline>[[Wikipedia:Pitulung|</syntaxhighlight>'''<code><nowiki>Pitulung</nowiki></code>'''<syntaxhighlight lang="lua" inline>]]</syntaxhighlight>. Other pre-save transforms, such as replacing <code>~~<nowiki/>~~</code> with signatures, will also fail to be processed. Template transclusions, parser function calls, and variable substitutions (i.e. anything with a <code><nowiki>{{...}}</nowiki></code>) will not be processed, nor will tags such as {{tag|ref|o}} or {{tag|nowiki|o}}. == Labeling converted templates == {{lua|Module:Bananas}} Please place the {{tl|lua}} template on the documentation subpage of all templates that use Lua. It will help to better communicate Lua usage and template conversions. {{clear}} == See also == * [[Husus:IndeksAwalan/Modul:]] daptar modul Lua * [[:Kategori:Lua-based templates]] &ndash; l-groups ta templates based kan Lua ; English Wikipedia-specific resources * [[:mw:Manual:Coding conventions/Lua]] &ndash; standards to improve the readability of code through consistency * [[:en:Help:Lua debugging]] &ndash; a how-to guide about debugging Lua modules * [[:en:Module:Sandbox]] provides a pseudo-namespace for experimenting with Lua modules * [[:en:Wikipedia talk:Lua]] &ndash; requests for Lua-based templates or tasks == Notes == {{reflist}} {{WikiProject Lua/header}} [[Category:Wikipedia modules]] oyzdkk608myw53uwy64ay3fpgfc4qif Siti Nurhaliza 0 99289 712177 712171 2026-08-21T15:03:56Z ~2026-38892-59 37068 /* Album duet */ 712177 wikitext text/x-wiki {{Infobox person | name = Dato' Sri<br/>Siti Nurhaliza<br/>SSAP DIMP JSM SAP PMP AAP | image = Siti Nurhaliza - Khairul Fahmi's Wedding 2013.jpg | image_size = | caption = | birth_name = Siti Nurhaliza binti Tarudin | birth_date = {{birth date and age|1979|01|11}} | birth_place = {{flagicon|Malaysia}} Kampung Awah, Temerloh, Pahang, [[Malaysia]] | other_names = Siti Nurhaliza | death_date = | death_place = | ethnicity = [[Urang Malayu|Malayu]] | years_active = [[1995]]-ayeuna | occupation = [[penyanyi|panyanyi]], [[aktor|aktris]], selebriti | religion = [[Islam]] | spouse = {{marriage|Khalid Mohamad Jiwa|21 August 2006}} | partner = | children = Siti Aafiyah binti Khalid<br/>Muhammad Afwa bin Khalid | parents = Tarudin Ismail<br/>Siti Salmah Bachik | module = {{Infobox musical artist | embed = yes | genre = [[Musik pop|Pop]], [[Musik rock|Rock]], Pop Melayu, Pop Rock, Soft Rock, Pop Tradisional, Nasyid, R&B | label = Suria Records ([[1995]]-[[2005]])<br/>Siti Nurhaliza Productions ([[2006]]-ayeuna)<br/>Universal Music Malaysia ([[2011]]-ayeuna)<br/>GP Records ([[Indonésia]]) | instrument = [[vokal]] | associated_acts = {{hlist|[[Krisdayanti]]|[[Syura Badron]]|[[Noraniza Idris]]}} }} | influences = | influenced = | website = }} Dato' Sri '''Siti Nurhaliza binti Tarudin''' langkung dikenal salaku '''Siti Nurhaliza''' SSAP DIMP JSM SAP PMP AAP ([[Abjad Jawi|Jawi]]: سيتي نورهاليزا بنت تارودين; {{lahirmati|Kampung Awah, Temerloh, Pahang, [[Malaysia]]|11|01|1979}}) nyaéta saurang [[panyanyi]], [[aktris]], panulis lagu, produser catetan sareng pangusaha anu asalna tina getih Melayu [[Malaysia]]. ==Diskografi== ===Album studio=== * ''[[Siti Nurhaliza 1]]'' (1996) * ''[[Siti Nurhaliza 2]]'' (1997) * ''[[Cindai]]'' (1997) * ''[[Adiwarna]]'' (1998) * ''[[Pancawarna]]'' (1999) * ''[[Sahmura]]'' (2000) * ''[[Safa]]'' (2001) * ''[[Sanggar Mustika]]'' (2002) * ''[[E.M.A.S]]'' (2003) * ''[[Anugerah Aidilfitri]]'' (2003) * ''[[Prasasti Seni]]'' (2004) * ''Transkripsi'' (2006) * ''Hadiah Daripada Hati'' (2007) * ''Lentera Timur'' (2008) * ''Tahajjud Cinta'' (2009) * ''All Your Love'' (2011) * ''Fragmen'' (2014) * ''SimetriSiti'' (2017) * ''ManifestaSITI2020'' (2020) * ''Legasi'' (2021) * ''Sitism'' (2023) * ''Gema Bumantara'' (2025) === Album duet === * ''[[Seri Balas]]'' (duet [[Noraniza Idris]]) (1999) * ''CTKD'' (duet [[Krisdayanti]]) (2009) === Album-album séjénna === * ''Molek'' (1998) * ''The Best of Siti Nurhaliza'' (2000) * ''Cerita Cinta Siti Nurhaliza'' (2006) * ''Klasik'' (2007) * ''[[Permata Irama]]'' (2008) * ''Siti & Friends'' (2010) * ''Pewaris Lagu-lagu Tradisional'' (2012) * ''Legasi'' (2021) ==Tumbu éksternal== * {{IMDb name|6021573}} * {{Instagram|ctdk}} {{authority control}} {{DEFAULTSORT:Nurhaliza, Siti}} [[Kategori:Panyanyi]] [[Kategori:Panyanyi Malaysia]] [[Kategori:Aktris Malaysia]] [[Kategori:Inohong Malayu]] [[Kategori:Siti Nurhaliza| ]] kkchxupj5984jqy8ucugfg2h67ulabe Adiwarna 0 99335 712188 711474 2026-08-22T03:48:34Z ~2026-38892-59 37068 /* */ 712188 wikitext text/x-wiki {{Infobox Album | Name = Adiwarna | Type = Studio | Cover = | Artist = [[Siti Nurhaliza]] | Released = [[29 Juni]] [[1998]] | Recorded = [[1997]]-[[1998]] | Length = 46:45 | Label = Suria Records | Producer = Adnan Abu Hassan, LY, Azmeer, Johari Teh, Salman, Azlan Abu Hassan & Zuriani | Last album = ''[[Cindai]]''<br>(1997) | This album = '''''Adiwarna'''''<br>(1998) | Next album = ''Molek''<br>(1998) }} '''''Adiwarna''''' nyaéta album studio kaopat [[Siti Nurhaliza]]. Albeum ieu dirilis dina taun [[1998]]. == Daptar lagu == # Purnama Merindu ''(Azmeer & Lukman S.)'' # Sendiri ''(LY & Baiduri)'' # Kita Kan Bersama ''(Malek Osman & Sham Amir Hussain)'' # Tak Rela Berpisah Darimu ''(Adnan Abu Hassan & Hani MJ)'' # Lagu Ku Di Hatimu ''(Salman & [[Siti Nurhaliza]])'' # Diari Hatimu ''(Ferdi Ferdian Khalid NS)'' # Satu Cinta Dua Jiwa ''(Azlan Abu Hassan & Ucu)'' # Demi Kasih Sayang ''(LY & Baiduri)'' # Tak Boleh Lupa ''(Johari Teh & Juwie)'' # Gelora Asmara ''([[Adnan Abu Hassan]] & Hazida)'' {{Authority control}} [[Kategori:Album]] [[Kategori:Siti Nurhaliza]] b6etegfgevowdavqtultpwsdevg8kk1 Seri Balas 0 99393 712189 712172 2026-08-22T03:48:55Z ~2026-38892-59 37068 /* */ 712189 wikitext text/x-wiki {{Infobox Album | Name = Seri Balas | Type = Studio | Artist = [[Siti Nurhaliza]] & [[Noraniza Idris]] | Cover = | Released = [[11 Januari]] [[1999]] | Recorded = [[1998]]-[[1999]] | Genre = [[Melayu]] | Length = 48:40 | Label = Suria Records | Producer = [[Pak Ngah]] | Last album = ''Molek''<br>(1998) | This album = '''''Seri Balas'''''<br>(1999) | Next album = ''[[Pancawarna]]''<br>(1999) }} '''''Seri Balas''''' nyaéta album duet [[Siti Nurhaliza]] & [[Noraniza Idris]]. Albeum ieu dirilis dina taun [[1999]]. Albeum dibébaskeun tanggal [[11 Januari]] [[1999]], dina ulang taun ka-20 [[Siti Nurhaliza]]. ==Daptar lagu== # ''Hati Kama'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu: [[Pak Ngah]]<br>Senikata: Hairul Anuar Harun # ''Ya Allah Ya Saidi'' ([[Noraniza Idris]])<br>Senilagu: Fadzil Ahmad<br>Senikata: Megamutiara # ''Ketawa Lagi'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu & Senikata: Copyright Control # ''Walinong Sari'' ([[Siti Nurhaliza]])<br>Senilagu & Senikata: Copyright Control # ''Merak Disangkar'' ([[Noraniza Idris]])<br>Senilagu: Copyright Control<br>Senikata: Nur Afdhal # ''Musalmah Manis'' ([[Siti Nurhaliza]])<br>Senilagu: Copyright Control<br>Senikata: Rahim Jantan # ''Pasir Salak'' ([[Noraniza Idris]])<br>Senilagu: Ku Zahir Ku Ahmad<br>Senikata: Nur Afdhal / J. Jamal # ''Lenggang Lenggok'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu: Fadzil Ahmad<br>Senikata: Hairul Anuar Harun / [[Siti Nurhaliza]] # ''Pulau Pisang'' ([[Siti Nurhaliza]])<br>Senilagu & Senikata: Copyright Control # ''Dondang Dendang'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu: Pak Ngah<br>Senikata: Hairul Anuar Harun {{Authority control}} [[Kategori:Album]] [[Kategori:Siti Nurhaliza]] s244y0v29wjl95aome7awrsi2jdc347 712190 712189 2026-08-22T03:50:53Z ~2026-38892-59 37068 /* */ 712190 wikitext text/x-wiki {{Infobox Album | Name = Seri Balas | Type = studio | Artist = [[Siti Nurhaliza]] & [[Noraniza Idris]] | Cover = | Released = [[11 Januari]] [[1999]] | Recorded = [[1998]] - [[1999]] | Genre = [[Musik Malayu|Malayu]] | Length = 48:40 | Label = Suria Records | Producer = [[Pak Ngah]] | Last album = [[Siti Nurhaliza]], [[Noraniza Idris]] & [[Liza Hanim]] - ''Molek''<br/>(1998) | This album = '''''Seri Balas'''''<br/>(1999) | Next album = [[Siti Nurhaliza]] - ''[[Pancawarna]]''<br><br/>[[Noraniza Idris]] - ''[[Bekaba]]''<br/>(1999) }} '''''Seri Balas''''' nyaéta album duet [[Siti Nurhaliza]] & [[Noraniza Idris]]. Albeum ieu dirilis dina taun [[1999]]. Albeum dibébaskeun tanggal [[11 Januari]] [[1999]], dina ulang taun ka-20 [[Siti Nurhaliza]]. ==Daptar lagu== # ''Hati Kama'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu: [[Pak Ngah]]<br>Senikata: Hairul Anuar Harun # ''Ya Allah Ya Saidi'' ([[Noraniza Idris]])<br>Senilagu: Fadzil Ahmad<br>Senikata: Megamutiara # ''Ketawa Lagi'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu & Senikata: Copyright Control # ''Walinong Sari'' ([[Siti Nurhaliza]])<br>Senilagu & Senikata: Copyright Control # ''Merak Disangkar'' ([[Noraniza Idris]])<br>Senilagu: Copyright Control<br>Senikata: Nur Afdhal # ''Musalmah Manis'' ([[Siti Nurhaliza]])<br>Senilagu: Copyright Control<br>Senikata: Rahim Jantan # ''Pasir Salak'' ([[Noraniza Idris]])<br>Senilagu: Ku Zahir Ku Ahmad<br>Senikata: Nur Afdhal / J. Jamal # ''Lenggang Lenggok'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu: Fadzil Ahmad<br>Senikata: Hairul Anuar Harun / [[Siti Nurhaliza]] # ''Pulau Pisang'' ([[Siti Nurhaliza]])<br>Senilagu & Senikata: Copyright Control # ''Dondang Dendang'' ([[Siti Nurhaliza]] & [[Noraniza Idris]])<br>Senilagu: Pak Ngah<br>Senikata: Hairul Anuar Harun {{Authority control}} [[Kategori:Album]] [[Kategori:Siti Nurhaliza]] 26u1y4qdwfv5j17q7lp2ymnizugixth Noraniza Idris 0 108821 712184 712176 2026-08-22T03:37:49Z ~2026-38892-59 37068 /* Diskografi */ 712184 wikitext text/x-wiki {{Infobox person |name = Noraniza Idris |native_name = {{font color|green|نورانيزا إدريس}} |image = Ratu Irama Pop Melayu Tradisional Malaysia.jpg |caption = Ratu Irama Pop Malayu Tradisional Malaysia |image_size = |birth_name = Nor Aniza binti Idris |nationality=[[Malaysia]] |other_names = Kak Ani |birth_date = {{birth date and age|1968|8|27}} |birth_place = {{flagicon|Malaysia}} Kampung Melayu, Kluang, Johor, [[Malaysia]] |religion = [[Islam]] |ethnicity = [[Urang Malayu|Malayu]] |occupation = {{hlist|[[Penyanyi]]|panulis lagu|panulis lirik|[[aktris]]|pangusaha}} |years_active = 1985–ayeuna |spouse={{marriage|Fareez Tajuddin|1988|2006|reason=divorced}} {{Marriage|Datuk Muhamad Mustafa Idrus|2008|2008|reason=divorced}} {{Marriage|Jeffri Iman|2011}} |children=2 |awards= |module = {{Infobox musical artist |embed = yes |genre = {{hlist|[[Musik pop|Pop]]|irama Malayu|rakyat|ghazal|joget|zapin|dikir barat|hadrah|ngajat|[[Musik Malayu|Malayu]]}} |associated_acts = [[Siti Nurhaliza]] |label = {{hlist|Life Records|Sony Music Entertainment|Suria Records|Universal Music Malaysia|Luncai Emas|Gerak Budaya Records|Erama Records|Noraniza Idris Production Ventures Sdn Bhd}} |instrument = [[Vokal]] }} }} '''Nor Aniza binti Idris''' ({{lahirmati|Kluang, Johor, [[Malaysia]]|27|08|1968}}), katelah '''Noraniza Idris''', nyaéta saurang [[penyanyi]], [[aktris]], panulis lagu, panulis lirik, produser rekaman, sareng pangusaha [[Malaysia]]. == Diskografi == *''Kaparinyo'' (1986) *''Nostalgia Malindo'' (1987) *''Mengemis Rindu'' (1987) *''Inginku Sandarkan Harapan'' (1988) *''Masihkah Dirimu Menyayangiku'' (1990) *''Noraniza Idris'' (1992) *''[[Ala Dondang]]'' (1997) *''Masyhur'' (1998) *''Bekaba'' (1999) *''Iktiraf'' (2000) *''Aura'' (2002) *''Sawo' Matang'' (2004) *''Cintaku Satu'' (2010) == Tumbu éksternal == * {{Instagram|noraniza_idris}} {{Authority control}} {{DEFAULTSORT:Idris, Noraniza}} [[Kategori:Panyanyi Malaysia]] [[Kategori:Aktris Malaysia]] [[Kategori:Inohong Malayu]] jjd5v7h35nwsqhwqvjy5in2t4yzrys5 712187 712184 2026-08-22T03:45:48Z ~2026-38892-59 37068 712187 wikitext text/x-wiki {{Infobox person |name = Noraniza Idris |native_name = {{font color|green|نورانيزا إدريس}} |image = Ratu Irama Pop Melayu Tradisional Malaysia.jpg |caption = Ratu Irama Pop Malayu Tradisional Malaysia |image_size = |birth_name = Nor Aniza binti Idris |nationality=[[Malaysia]] |other_names = Kak Ani |birth_date = {{birth date and age|1968|8|27}} |birth_place = {{flagicon|Malaysia}} Kampung Melayu, Kluang, Johor, [[Malaysia]] |religion = [[Islam]] |ethnicity = [[Urang Malayu|Malayu]] |occupation = {{hlist|[[Penyanyi]]|panulis lagu|panulis lirik|[[aktris]]|pangusaha}} |years_active = 1985–ayeuna |spouse={{marriage|Fareez Tajuddin|1988|2006|reason=divorced}} {{Marriage|Datuk Muhamad Mustafa Idrus|2008|2008|reason=divorced}} {{Marriage|Jeffri Iman|2011}} |children=2 |awards= |module = {{Infobox musical artist |embed = yes |genre = {{hlist|[[Musik pop|Pop]]|irama Malayu|rakyat|ghazal|joget|zapin|dikir barat|hadrah|ngajat|[[Musik Malayu|Malayu]]}} |associated_acts = [[Siti Nurhaliza]] |label = {{hlist|Life Records|Sony Music Entertainment|Suria Records|Universal Music Malaysia|Luncai Emas|Gerak Budaya Records|Erama Records|Noraniza Idris Production Ventures Sdn Bhd}} |instrument = [[Vokal]] }} }} '''Nor Aniza binti Idris''' ({{lahirmati|Kluang, Johor, [[Malaysia]]|27|08|1968}}), katelah '''Noraniza Idris''', nyaéta saurang [[penyanyi]], [[aktris]], panulis lagu, panulis lirik, produser rekaman, sareng pangusaha [[Malaysia]]. == Diskografi == *''Kaparinyo'' (1986) *''Nostalgia Malindo'' (1987) *''Mengemis Rindu'' (1987) *''Inginku Sandarkan Harapan'' (1988) *''Masihkah Dirimu Menyayangiku'' (1990) *''Noraniza Idris'' (1992) *''[[Ala Dondang]]'' (1997) *''[[Masyhur]]'' (1998) *''Bekaba'' (1999) *''Iktiraf'' (2000) *''Aura'' (2002) *''Sawo' Matang'' (2004) *''Cintaku Satu'' (2010) == Tumbu éksternal == * {{Instagram|noraniza_idris}} {{Authority control}} {{DEFAULTSORT:Idris, Noraniza}} [[Kategori:Panyanyi Malaysia]] [[Kategori:Aktris Malaysia]] [[Kategori:Inohong Malayu]] qb6wb1ydinkb7rznbicbbp3hnpfcmsr 712192 712187 2026-08-22T03:56:31Z ~2026-38892-59 37068 712192 wikitext text/x-wiki {{Infobox person |name = Noraniza Idris |native_name = {{font color|green|نورانيزا إدريس}} |image = Ratu Irama Pop Melayu Tradisional Malaysia.jpg |caption = Ratu Irama Pop Malayu Tradisional Malaysia |image_size = |birth_name = Nor Aniza binti Idris |nationality=[[Malaysia]] |other_names = Kak Ani |birth_date = {{birth date and age|1968|8|27}} |birth_place = {{flagicon|Malaysia}} Kampung Melayu, Kluang, Johor, [[Malaysia]] |religion = [[Islam]] |ethnicity = [[Urang Malayu|Malayu]] |occupation = {{hlist|[[Penyanyi]]|panulis lagu|panulis lirik|[[aktris]]|pangusaha}} |years_active = 1985–ayeuna |spouse={{marriage|Fareez Tajuddin|1988|2006|reason=divorced}} {{Marriage|Datuk Muhamad Mustafa Idrus|2008|2008|reason=divorced}} {{Marriage|Jeffri Iman|2011}} |children=2 |awards= |module = {{Infobox musical artist |embed = yes |genre = {{hlist|[[Musik pop|Pop]]|irama Malayu|rakyat|ghazal|joget|zapin|dikir barat|hadrah|ngajat|[[Musik Malayu|Malayu]]}} |associated_acts = [[Siti Nurhaliza]] |label = {{hlist|Life Records|Sony Music Entertainment|Suria Records|Universal Music Malaysia|Luncai Emas|Gerak Budaya Records|Erama Records|Noraniza Idris Production Ventures Sdn Bhd}} |instrument = [[Vokal]] }} }} '''Nor Aniza binti Idris''' ({{lahirmati|Kluang, Johor, [[Malaysia]]|27|08|1968}}), katelah '''Noraniza Idris''', nyaéta saurang [[penyanyi]], [[aktris]], panulis lagu, panulis lirik, produser rekaman, sareng pangusaha [[Malaysia]]. == Diskografi == *''Kaparinyo'' (1986) *''Nostalgia Malindo'' (1987) *''Mengemis Rindu'' (1987) *''Inginku Sandarkan Harapan'' (1988) *''Masihkah Dirimu Menyayangiku'' (1990) *''Noraniza Idris'' (1992) *''[[Ala Dondang]]'' (1997) *''[[Masyhur]]'' (1998) *''[[Bekaba]]'' (1999) *''Iktiraf'' (2000) *''Aura'' (2002) *''Sawo' Matang'' (2004) *''Cintaku Satu'' (2010) == Tumbu éksternal == * {{Instagram|noraniza_idris}} {{Authority control}} {{DEFAULTSORT:Idris, Noraniza}} [[Kategori:Panyanyi Malaysia]] [[Kategori:Aktris Malaysia]] [[Kategori:Inohong Malayu]] mcny5pdee24aieksyt9gqrys8mva10b 712194 712192 2026-08-22T04:04:00Z ~2026-38892-59 37068 /* Diskografi */ 712194 wikitext text/x-wiki {{Infobox person |name = Noraniza Idris |native_name = {{font color|green|نورانيزا إدريس}} |image = Ratu Irama Pop Melayu Tradisional Malaysia.jpg |caption = Ratu Irama Pop Malayu Tradisional Malaysia |image_size = |birth_name = Nor Aniza binti Idris |nationality=[[Malaysia]] |other_names = Kak Ani |birth_date = {{birth date and age|1968|8|27}} |birth_place = {{flagicon|Malaysia}} Kampung Melayu, Kluang, Johor, [[Malaysia]] |religion = [[Islam]] |ethnicity = [[Urang Malayu|Malayu]] |occupation = {{hlist|[[Penyanyi]]|panulis lagu|panulis lirik|[[aktris]]|pangusaha}} |years_active = 1985–ayeuna |spouse={{marriage|Fareez Tajuddin|1988|2006|reason=divorced}} {{Marriage|Datuk Muhamad Mustafa Idrus|2008|2008|reason=divorced}} {{Marriage|Jeffri Iman|2011}} |children=2 |awards= |module = {{Infobox musical artist |embed = yes |genre = {{hlist|[[Musik pop|Pop]]|irama Malayu|rakyat|ghazal|joget|zapin|dikir barat|hadrah|ngajat|[[Musik Malayu|Malayu]]}} |associated_acts = [[Siti Nurhaliza]] |label = {{hlist|Life Records|Sony Music Entertainment|Suria Records|Universal Music Malaysia|Luncai Emas|Gerak Budaya Records|Erama Records|Noraniza Idris Production Ventures Sdn Bhd}} |instrument = [[Vokal]] }} }} '''Nor Aniza binti Idris''' ({{lahirmati|Kluang, Johor, [[Malaysia]]|27|08|1968}}), katelah '''Noraniza Idris''', nyaéta saurang [[penyanyi]], [[aktris]], panulis lagu, panulis lirik, produser rekaman, sareng pangusaha [[Malaysia]]. == Diskografi == *''Kaparinyo'' (1986) *''Nostalgia Malindo'' (1987) *''Mengemis Rindu'' (1987) *''Inginku Sandarkan Harapan'' (1988) *''Masihkah Dirimu Menyayangiku'' (1990) *''Noraniza Idris'' (1992) *''[[Ala Dondang]]'' (1997) *''[[Masyhur]]'' (1998) *''[[Bekaba]]'' (1999) *''[[Iktiraf]]'' (2000) *''Aura'' (2002) *''Sawo' Matang'' (2004) *''Cintaku Satu'' (2010) == Tumbu éksternal == * {{Instagram|noraniza_idris}} {{Authority control}} {{DEFAULTSORT:Idris, Noraniza}} [[Kategori:Panyanyi Malaysia]] [[Kategori:Aktris Malaysia]] [[Kategori:Inohong Malayu]] my55k1dyrdqsqdcw5vo602dyg6si4a8 712196 712194 2026-08-22T04:33:29Z ~2026-38892-59 37068 /* Diskografi */ 712196 wikitext text/x-wiki {{Infobox person |name = Noraniza Idris |native_name = {{font color|green|نورانيزا إدريس}} |image = Ratu Irama Pop Melayu Tradisional Malaysia.jpg |caption = Ratu Irama Pop Malayu Tradisional Malaysia |image_size = |birth_name = Nor Aniza binti Idris |nationality=[[Malaysia]] |other_names = Kak Ani |birth_date = {{birth date and age|1968|8|27}} |birth_place = {{flagicon|Malaysia}} Kampung Melayu, Kluang, Johor, [[Malaysia]] |religion = [[Islam]] |ethnicity = [[Urang Malayu|Malayu]] |occupation = {{hlist|[[Penyanyi]]|panulis lagu|panulis lirik|[[aktris]]|pangusaha}} |years_active = 1985–ayeuna |spouse={{marriage|Fareez Tajuddin|1988|2006|reason=divorced}} {{Marriage|Datuk Muhamad Mustafa Idrus|2008|2008|reason=divorced}} {{Marriage|Jeffri Iman|2011}} |children=2 |awards= |module = {{Infobox musical artist |embed = yes |genre = {{hlist|[[Musik pop|Pop]]|irama Malayu|rakyat|ghazal|joget|zapin|dikir barat|hadrah|ngajat|[[Musik Malayu|Malayu]]}} |associated_acts = [[Siti Nurhaliza]] |label = {{hlist|Life Records|Sony Music Entertainment|Suria Records|Universal Music Malaysia|Luncai Emas|Gerak Budaya Records|Erama Records|Noraniza Idris Production Ventures Sdn Bhd}} |instrument = [[Vokal]] }} }} '''Nor Aniza binti Idris''' ({{lahirmati|Kluang, Johor, [[Malaysia]]|27|08|1968}}), katelah '''Noraniza Idris''', nyaéta saurang [[penyanyi]], [[aktris]], panulis lagu, panulis lirik, produser rekaman, sareng pangusaha [[Malaysia]]. == Diskografi == *''Kaparinyo'' (1986) *''Nostalgia Malindo'' (1987) *''Mengemis Rindu'' (1987) *''Inginku Sandarkan Harapan'' (1988) *''Masihkah Dirimu Menyayangiku'' (1990) *''Noraniza Idris'' (1992) *''[[Ala Dondang]]'' (1997) *''[[Masyhur]]'' (1998) *''[[Bekaba]]'' (1999) *''[[Iktiraf]]'' (2000) *''[[Aura (album)|Aura]]'' (2002) *''Sawo' Matang'' (2004) *''Cintaku Satu'' (2010) == Tumbu éksternal == * {{Instagram|noraniza_idris}} {{Authority control}} {{DEFAULTSORT:Idris, Noraniza}} [[Kategori:Panyanyi Malaysia]] [[Kategori:Aktris Malaysia]] [[Kategori:Inohong Malayu]] o67gk1zatngxmmer8dc1pl9uiw2jbgv Ala Dondang 0 108822 712183 2026-08-22T03:36:58Z ~2026-38892-59 37068 Nyieun kaca anyar {{Infobox Album | Name = Ala Dondang | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1997|07|28}}<ref>https://itunes.apple.com/nz/album/ala-dondang/id803798462</ref> | Recorded = 1996–1997 | Genre = [[Musik Malayu|Malayu]] | Length =44:34 | Label = Suria Records | Producer = [[Pak Ngah]] • S. Atan | Reviews = | Last album = ''Noraniza Idris''<br/>(1992) | This album = '''''Ala Dondang'''''<br/>(1997) | Next album = ''[[Masyhur]]''<b... 712183 wikitext text/x-wiki {{Infobox Album | Name = Ala Dondang | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1997|07|28}}<ref>https://itunes.apple.com/nz/album/ala-dondang/id803798462</ref> | Recorded = 1996–1997 | Genre = [[Musik Malayu|Malayu]] | Length =44:34 | Label = Suria Records | Producer = [[Pak Ngah]] • S. Atan | Reviews = | Last album = ''Noraniza Idris''<br/>(1992) | This album = '''''Ala Dondang'''''<br/>(1997) | Next album = ''[[Masyhur]]''<br/> (1998) | Misc = }} '''''Ala Dondang''''' nyaéta album studio katujuh ku [[penyanyi]] sareng [[aktris]] [[Malaysia]], [[Noraniza Idris]]. Album ieu dirilis dina tanggal [[28 Juli]] [[1997]]. == Daptar lagu == # "'''Awallah Dondang'''"<br>Senilagu: Anak Sarawak<br>Senikata: Hairul Anuar Harun # "'''Semalu Rimba'''"<br>Senilagu: Khalil Shariff<br>Senikata: Hairul Anuar Harun # "'''Joget Orang Berkasih'''"<br>Senilagu: S. Atan<br>Senikata: Siso Kopratasa # "'''Rindu'''"<br>Senilagu: Fandi<br>Senikata: Siso Kopratasa # "'''Mustika Hati'''"<br>Senilagu & Senikata: Atan Ahmad # "'''Purnama'''"<br>Senilagu & Senikata: Rahim Jantan # "'''Mahligai Asli'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Lokgha # "'''Padamu Jua'''"<br>Senilagu: Jamal Abdillah<br>Senikata: Habsah Hassan # "'''Embun Setitik'''"<br>Senilagu: Arid<br>Senikata: Hairul Anuar Harun # "'''Inang Merindu'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Lokgha {{Authority control}} [[Kategori:Album]] mmxqzvoh42dpn8g89djdty7qa4i8c4i 712185 712183 2026-08-22T03:40:43Z ~2026-38892-59 37068 /* Daptar lagu */ 712185 wikitext text/x-wiki {{Infobox Album | Name = Ala Dondang | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1997|07|28}}<ref>https://itunes.apple.com/nz/album/ala-dondang/id803798462</ref> | Recorded = 1996–1997 | Genre = [[Musik Malayu|Malayu]] | Length =44:34 | Label = Suria Records | Producer = [[Pak Ngah]] • S. Atan | Reviews = | Last album = ''Noraniza Idris''<br/>(1992) | This album = '''''Ala Dondang'''''<br/>(1997) | Next album = ''[[Masyhur]]''<br/> (1998) | Misc = }} '''''Ala Dondang''''' nyaéta album studio katujuh ku [[penyanyi]] sareng [[aktris]] [[Malaysia]], [[Noraniza Idris]]. Album ieu dirilis dina tanggal [[28 Juli]] [[1997]]. == Daptar lagu == # "'''Awallah Dondang'''"<br>Senilagu: Anak Sarawak<br>Senikata: Hairul Anuar Harun # "'''Semalu Rimba'''"<br>Senilagu: Khalil Shariff<br>Senikata: Hairul Anuar Harun # "'''Joget Orang Berkasih'''"<br>Senilagu: S. Atan<br>Senikata: Siso Kopratasa # "'''Rindu'''"<br>Senilagu: Fandi<br>Senikata: Siso Kopratasa # "'''Mustika Hati'''"<br>Senilagu & Senikata: Atan Ahmad # "'''Purnama'''"<br>Senilagu & Senikata: Rahim Jantan # "'''Mahligai Asli'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Lokgha # "'''Padamu Jua'''"<br>Senilagu: Jamal Abdillah<br>Senikata: Habsah Hassan # "'''Embun Setitik'''"<br>Senilagu: Arid<br>Senikata: Hairul Anuar Harun # "'''Inang Merindu'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Lokgha == Réferénsi == {{reflist}} {{Authority control}} [[Kategori:Album]] 0zsk2pc5dgrdjvj4svy17kqo1eflk3b Masyhur 0 108823 712186 2026-08-22T03:44:51Z ~2026-38892-59 37068 Nyieun kaca anyar {{Infobox Album | Name = Masyhur | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1998|06|1}}<ref>https://itunes.apple.com/nz/album/masyhur/id803726920</ref> | Recorded = 1997–1998 | Genre = [[Musik Malayu|Malayu]] | Length =50:17 | Label = Suria Records | Producer = [[Pak Ngah]] • S. Atan | Reviews = | Last album = ''[[Ala Dondang]]''<br/>(1997) | This album = '''''Masyhur'''''<br/>(1998) | Next album = ''Molek''<br/> (1998) | Misc... 712186 wikitext text/x-wiki {{Infobox Album | Name = Masyhur | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1998|06|1}}<ref>https://itunes.apple.com/nz/album/masyhur/id803726920</ref> | Recorded = 1997–1998 | Genre = [[Musik Malayu|Malayu]] | Length =50:17 | Label = Suria Records | Producer = [[Pak Ngah]] • S. Atan | Reviews = | Last album = ''[[Ala Dondang]]''<br/>(1997) | This album = '''''Masyhur'''''<br/>(1998) | Next album = ''Molek''<br/> (1998) | Misc = }} '''''Masyhur''''' nyaéta album studio kadalapan ku [[penyanyi]] sareng [[aktris]] [[Malaysia]], [[Noraniza Idris]]. Album ieu dirilis dina tanggal [[1 Juni]] [[1998]]. == Daptar lagu == # "'''Gurindam Masyhur'''" # "'''Dikir Puteri'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Hairul Anuar Harun # "'''Joget Berkias Kasih'''"<br>Senilagu: S. Atan<br>Senikata: Siso Kopratasa # "'''Permata Kasih'''"<br>Senilagu: S.M. Noor<br>Senikata: Nurul Asyiqin # "'''Lat Tali Lat'''"<br>Senilagu & Senikata: Kazar Saisi # "'''Zapin Pusaka'''"<br>Senilagu: Fadzil Ahmad<br>Senikata: Megamutiara # "'''Di Anjung Rindu'''"<br>Senilagu: Rahim Jantan<br>Senikata: Nurul Asyiqin # "'''Joget Mengidam Rindu'''"<br>Senilagu & Senikata: Raja Kobat # "'''Dendang Anak'''"<br>Senilagu & Senikata: Ahmad Jusoh # "'''Kisah Satu Malam'''"<br>Senilagu: Anak Sarawak<br>Senikata: Hairul Anuar Harun # "'''Dondang Dendang'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Hairul Anuar Harun == Réferénsi == {{reflist}} {{Authority control}} [[Kategori:Album]] b8p6h0f4e3eorz9k3cwjwqo4por0s14 Bekaba 0 108824 712191 2026-08-22T03:55:41Z ~2026-38892-59 37068 Nyieun kaca anyar {{Infobox Album | Name = Bekaba | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1999|08|23}}<ref>https://itunes.apple.com/nz/album/bekaba/id803773919</ref> | Recorded = 1998–1999 | Genre = [[Musik Malayu|Malayu]] | Length =57:44 | Label = Suria Records | Producer = [[Pak Ngah]] • To' Ki • Rosli Selasih | Reviews = | Last album = ''[[Seri Balas]]''<br/>(1999) | This album = '''''Bekaba'''''<br/>(1999) | Next album = ''[[Iktiraf]]''... 712191 wikitext text/x-wiki {{Infobox Album | Name = Bekaba | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|1999|08|23}}<ref>https://itunes.apple.com/nz/album/bekaba/id803773919</ref> | Recorded = 1998–1999 | Genre = [[Musik Malayu|Malayu]] | Length =57:44 | Label = Suria Records | Producer = [[Pak Ngah]] • To' Ki • Rosli Selasih | Reviews = | Last album = ''[[Seri Balas]]''<br/>(1999) | This album = '''''Bekaba'''''<br/>(1999) | Next album = ''[[Iktiraf]]''<br/> (2000) | Misc = }} '''''Bekaba''''' nyaéta album studio kasalapan ku [[penyanyi]] sareng [[aktris]] [[Malaysia]], [[Noraniza Idris]]. Album ieu dirilis dina tanggal [[23 Agustus]] [[1999]]. == Daptar lagu == # "'''Kisah Barat (Introduksi)'''"<br>Senilagu: Tradisional Makyong<br>Senikata: Hairul Anuar Harun # "'''Tinting'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Hairul Anuar Harun # "'''Ngajat Tampi'''"<br>Senilagu: Rosli Selasih<br>Senikata: Siso Kopratasa # "'''Panji Sumandak'''"<br>Senilagu: To'Ki<br>Senikata: Tok Wan # "'''Sapta'''"<br>Senilagu: Manan Ngah<br>Senikata: Hairul Anuar Harun # "'''Selat Tebrau'''"<br>Senilagu & Senikata: Ahmad Jusoh # "'''Joget Si Kaduk Junjung'''"<br>Senilagu & Senikata: Raja Kobat # "'''Laksana Dikata'''"<br>Senilagu: Shireen Jasin Mokhtar<br>Senikata: Megamutiara # "'''Ya Kasih'''"<br>Senilagu: To' Ki / Jamal Abdillah<br>Senikata: To' Ki # "'''Sang Puteri'''"<br>Senilagu: Rosli Selasih<br>Senikata: Siso Kopratasa # "'''Si Nara'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Hairul Anuar Harun # "'''Tinting (Minus One)'''" == Réferénsi == {{reflist}} {{Authority control}} [[Kategori:Album]] 570jmdpier7zw2yprxum0x0eclx28f1 Iktiraf 0 108825 712193 2026-08-22T04:03:08Z ~2026-38892-59 37068 Nyieun kaca anyar {{Infobox Album | Name = Iktiraf | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|2000|11|27}}<ref>https://itunes.apple.com/nz/album/iktiraf/id803763233</ref> | Recorded = 1999–2000 | Genre = [[Musik Malayu|Malayu]] | Length =51:51 | Label = Suria Records | Producer = [[Pak Ngah]] | Reviews = | Last album = ''[[Bekaba]]''<br/>(1999) | This album = '''''Iktiraf'''''<br/>(2000) | Next album = ''[[Aura (album)|Aura]]''<br/> (2002) | Misc... 712193 wikitext text/x-wiki {{Infobox Album | Name = Iktiraf | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|2000|11|27}}<ref>https://itunes.apple.com/nz/album/iktiraf/id803763233</ref> | Recorded = 1999–2000 | Genre = [[Musik Malayu|Malayu]] | Length =51:51 | Label = Suria Records | Producer = [[Pak Ngah]] | Reviews = | Last album = ''[[Bekaba]]''<br/>(1999) | This album = '''''Iktiraf'''''<br/>(2000) | Next album = ''[[Aura (album)|Aura]]''<br/> (2002) | Misc = }} '''''Iktiraf''''' nyaéta album studio kasapuluh ku [[penyanyi]] sareng [[aktris]] [[Malaysia]], [[Noraniza Idris]]. Album ieu dirilis dina tanggal [[27 Nopémber]] [[2000]]. == Daptar lagu == # "'''Mengulek (Prolog)'''"<br>Senilagu: Tradisional Makyong<br>Senikata: Ce' Kem # "'''Iboq (Kita)'''"<br>Senilagu: Indra<br>Senikata: Siso Kopratasa # "'''Manira'''"<br>Senilagu: [[Pak Ngah]] / Fadzil Ahmad<br>Senikata: Ce'Kem # "'''Laduni'''"<br>Senilagu: [[Pak Ngah]]<br>Senikata: Samoza # "'''Malinja'''"<br>Senilagu & Senikata: Ahmad Jusoh # "'''Logamaya'''"<br>Senilagu: Pak Ngah<br>Senikata: Samoza # "'''Empat Dara'''"<br>Senilagu: Atan Ahmad<br>Senikata: Ahmad Jusoh # "'''Dewangga'''"<br>Senilagu: Indra<br>Senikata: A. Wahid Nasir # "'''Kuala Mersing'''"<br>Senilagu & Senikata: Atan Penambang # "'''Ya Salam'''"<br>Senilagu: Anak Johor<br>Senikata: Ce'Kem # "'''Joget Dondang Sayang'''"<br>Senilagu & Senikata: Raja Kobat == Réferénsi == {{reflist}} {{Authority control}} [[Kategori:Album]] s6s89o1lvyyys7h0xjg1yb19yquhxxy Aura (album) 0 108826 712195 2026-08-22T04:32:21Z ~2026-38892-59 37068 Nyieun kaca anyar {{Infobox Album | Name = Aura | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|2002|07|29}} | Recorded = 2001–2002 | Genre = [[Musik Malayu|Malayu]] | Length = | Label = Suria Records | Producer = Fareez Tajuddin | Reviews = | Last album = ''[[Iktiraf]]''<br/>(2000) | This album = '''''Aura'''''<br/>(2002) | Next album = ''Sawo Matang''<br/> (2004) | Misc = }} '''''Aura''''' nyaéta album studio ka-sabelas ku [[penyanyi]] sare... 712195 wikitext text/x-wiki {{Infobox Album | Name = Aura | Type = studio | Artist = [[Noraniza Idris]] | Cover = | Released = {{start date|2002|07|29}} | Recorded = 2001–2002 | Genre = [[Musik Malayu|Malayu]] | Length = | Label = Suria Records | Producer = Fareez Tajuddin | Reviews = | Last album = ''[[Iktiraf]]''<br/>(2000) | This album = '''''Aura'''''<br/>(2002) | Next album = ''Sawo Matang''<br/> (2004) | Misc = }} '''''Aura''''' nyaéta album studio ka-sabelas ku [[penyanyi]] sareng [[aktris]] [[Malaysia]], [[Noraniza Idris]]. Album ieu dirilis dina tanggal [[29 Juli]] [[2002]]. == Daptar lagu == # "'''Hala Timur'''"<br>Senilagu: Addy Hamid<br>Senikata: ND Lala # "'''Tandang Bermadah'''"<br>Senilagu: [[Noraniza Idris]] / Narawi CD<br>Senikata: YM Raja Kobat / Noraniza Idris # "'''Serampang Bugis'''"<br>Senilagu & Senikata: YM Raja Kobat # "'''Layar Battuta'''"<br>Senilagu: [[Adnan Abu Hassan]]<br>Senikata: Hairul Anuar Harun # "'''Berendoi'''"<br>Senilagu: Rosli Selasih<br>Senikata: Noraniza Idris / Rosli Selasih # "'''Putera Lantai Emas'''"<br>Senilagu: Indra<br>Senikata: Nane Surya # "'''Syakuntala'''"<br>Senilagu: Anak Johor<br>Senikata: Hairul Anuar Harun # "'''Hijrah Kencana'''"<br>Senilagu: Indra<br>Senikata: Adika # "'''Melereng'''"<br>Senilagu: Rosli Selasih<br>Senikata: Sulastri Siri # "'''Raja Alang'''"<br>Senilagu & Senikata: Rosiah Chik {{Authority control}} {{DEFAULTSORT:Aura}} [[Kategori:Album]] ko70i7cebqdn341v5dmwz287xg6stlh Modul:ScribuntoUnit 828 108827 712197 2026-08-22T08:50:14Z Nimmzo 37272 [[:en:Module:ScribuntoUnit]] unit test framework for Lua Scribunto requires [[Modul:ScribuntoUnit/config]] 712197 Scribunto text/plain ------------------------------------------------------------------------------- -- Unit tests for Scribunto. ------------------------------------------------------------------------------- require('strict') local DebugHelper = {} local ScribuntoUnit = {} ScribuntoUnit.__meta = {} -- The cfg table contains all localisable strings and configuration, to make it -- easier to port this module to another wiki. local cfg = mw.loadData('Module:ScribuntoUnit/config') ------------------------------------------------------------------------------- -- Concatenates keys and values, ideal for displaying a template or parser function argument table. -- @param keySeparator glue between key and value (defaults to " = ") -- @param separator glue between different key-value pairs (defaults to ", ") -- @example concatWithKeys({a = 1, b = 2, c = 3}, ' => ', ', ') => "a => 1, b => 2, c => 3" -- function DebugHelper.concatWithKeys(table, keySeparator, separator) keySeparator = keySeparator or ' = ' separator = separator or ', ' local concatted = '' local i = 1 local first = true local unnamedArguments = true for k, v in pairs(table) do if first then first = false else concatted = concatted .. separator end if k == i and unnamedArguments then i = i + 1 concatted = concatted .. tostring(v) else unnamedArguments = false concatted = concatted .. tostring(k) .. keySeparator .. tostring(v) end end return concatted end ------------------------------------------------------------------------------- -- Compares two tables recursively (non-table values are handled correctly as well). -- @param ignoreMetatable if false, t1.__eq is used for the comparison -- function DebugHelper.deepCompare(t1, t2, ignoreMetatable) local type1 = type(t1) local type2 = type(t2) if type1 ~= type2 then return false end if type1 ~= 'table' then return t1 == t2 end local metatable = getmetatable(t1) if not ignoreMetatable and metatable and metatable.__eq then return t1 == t2 end for k1, v1 in pairs(t1) do local v2 = t2[k1] if v2 == nil or not DebugHelper.deepCompare(v1, v2) then return false end end for k2, v2 in pairs(t2) do if t1[k2] == nil then return false end end return true end ------------------------------------------------------------------------------- -- Raises an error with stack information -- @param details a table with error details -- - should have a 'text' key which is the error message to display -- - a 'trace' key will be added with the stack data -- - and a 'source' key with file/line number -- - a metatable will be added for error handling -- function DebugHelper.raise(details, level) level = (level or 1) + 1 details.trace = debug.traceback('', level) details.source = string.match(details.trace, '^%s*stack traceback:%s*(%S*: )') -- setmetatable(details, { -- __tostring: function() return details.text end -- }) error(details, level) end ------------------------------------------------------------------------------- -- when used in a test, that test gets ignored, and the skipped count increases by one. -- function ScribuntoUnit:markTestSkipped() DebugHelper.raise({ScribuntoUnit = true, skipped = true}, 3) end ------------------------------------------------------------------------------- -- Unconditionally fail a test -- @param message optional description of the test -- function ScribuntoUnit:fail(message) DebugHelper.raise({ScribuntoUnit = true, text = "Test failed", message = message}, 2) end ------------------------------------------------------------------------------- -- Checks that the input is true -- @param message optional description of the test -- @param level optional number to raise error stack level by -- function ScribuntoUnit:assertTrue(actual, message, level) if not actual then DebugHelper.raise({ScribuntoUnit = true, text = string.format("Failed to assert that %s is true", tostring(actual)), message = message}, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks that the input is false -- @param message optional description of the test -- @param level optional number to raise error stack level by -- function ScribuntoUnit:assertFalse(actual, message, level) if actual then DebugHelper.raise({ScribuntoUnit = true, text = string.format("Failed to assert that %s is false", tostring(actual)), message = message}, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks an input string contains the expected string -- @param message optional description of the test -- @param plain search is made with a plain string instead of a ustring pattern -- @param level optional number to raise error stack level by -- function ScribuntoUnit:assertStringContains(pattern, s, plain, message, level) if type(pattern) ~= 'string' then DebugHelper.raise({ ScribuntoUnit = true, text = mw.ustring.format("Pattern type error (expected string, got %s)", type(pattern)), message = message }, 2 + (level or 0)) end if type(s) ~= 'string' then DebugHelper.raise({ ScribuntoUnit = true, text = mw.ustring.format("String type error (expected string, got %s)", type(s)), message = message }, 2 + (level or 0)) end if not mw.ustring.find(s, pattern, nil, plain) then DebugHelper.raise({ ScribuntoUnit = true, text = mw.ustring.format('Failed to find %s "%s" in string "%s"', plain and "plain string" or "pattern", pattern, s), message = message }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks an input string doesn't contain the expected string -- @param message optional description of the test -- @param plain search is made with a plain string instead of a ustring pattern -- @param level optional number to raise error stack level by -- function ScribuntoUnit:assertNotStringContains(pattern, s, plain, message, level) if type(pattern) ~= 'string' then DebugHelper.raise({ ScribuntoUnit = true, text = mw.ustring.format("Pattern type error (expected string, got %s)", type(pattern)), message = message }, 2 + (level or 0)) end if type(s) ~= 'string' then DebugHelper.raise({ ScribuntoUnit = true, text = mw.ustring.format("String type error (expected string, got %s)", type(s)), message = message }, 2 + (level or 0)) end local i, j = mw.ustring.find(s, pattern, nil, plain) if i then local match = mw.ustring.sub(s, i, j) DebugHelper.raise({ ScribuntoUnit = true, text = mw.ustring.format('Found match "%s" for %s "%s"', match, plain and "plain string" or "pattern", pattern), message = message }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks that an input has the expected value. -- @param message optional description of the test -- @example assertEquals(4, add(2,2), "2+2 should be 4") -- @param level optional number to raise error stack level by -- function ScribuntoUnit:assertEquals(expected, actual, message, level) if type(expected) == 'number' and type(actual) == 'number' then self:assertWithinDelta(expected, actual, 1e-8, message, (level or 0) + 1) elseif expected ~= actual then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s equals expected %s", tostring(actual), tostring(expected)), actual = actual, expected = expected, message = message, }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks that an input does not have the expected value. -- @param message optional description of the test -- @example assertNotEquals(5, add(2,2), "2+2 should not be 5") -- @param level optional number to raise error stack level by -- function ScribuntoUnit:assertNotEquals(expected, actual, message, level) if type(expected) == 'number' and type(actual) == 'number' then self:assertNotWithinDelta(expected, actual, 1e-8, message, (level or 0) + 1) elseif expected == actual then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s does not equal expected %s", tostring(actual), tostring(expected)), actual = actual, expected = expected, message = message, }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Validates that both the expected and actual values are numbers -- @param message optional description of the test -- @param level number to raise error stack level by -- local function validateNumbers(expected, actual, message, level) if type(expected) ~= "number" then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Expected value %s is not a number", tostring(expected)), actual = actual, expected = expected, message = message, }, 3 + level) end if type(actual) ~= "number" then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Actual value %s is not a number", tostring(actual)), actual = actual, expected = expected, message = message, }, 3 + level) end end ------------------------------------------------------------------------------- -- Checks that 'actual' is within 'delta' of 'expected'. -- @param message optional description of the test -- @param level optional number to raise error stack level by -- @example assertWithinDelta(1/3, 3/9, 0.000001, "3/9 should be 1/3") function ScribuntoUnit:assertWithinDelta(expected, actual, delta, message, level) validateNumbers(expected, actual, message, level or 0) local diff = expected - actual if diff < 0 then diff = - diff end -- instead of importing math.abs if diff > delta then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %f is within %f of expected %f", actual, delta, expected), actual = actual, expected = expected, message = message, }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks that 'actual' is not within 'delta' of 'expected'. -- @param message optional description of the test -- @param level optional number to raise error stack level by -- @example assertNotWithinDelta(1/3, 2/3, 0.000001, "1/3 should not be 2/3") function ScribuntoUnit:assertNotWithinDelta(expected, actual, delta, message, level) validateNumbers(expected, actual, message, level or 0) local diff = expected - actual if diff < 0 then diff = - diff end -- instead of importing math.abs if diff <= delta then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %f is not within %f of expected %f", actual, delta, expected), actual = actual, expected = expected, message = message, }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks that a table has the expected value (including sub-tables). -- @param message optional description of the test -- @param level optional number to raise error stack level by -- @example assertDeepEquals({{1,3}, {2,4}}, partition(odd, {1,2,3,4})) function ScribuntoUnit:assertDeepEquals(expected, actual, message, level) if not DebugHelper.deepCompare(expected, actual) then if type(expected) == 'table' then expected = mw.dumpObject(expected) end if type(actual) == 'table' then actual = mw.dumpObject(actual) end DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s equals expected %s", tostring(actual), tostring(expected)), actual = actual, expected = expected, message = message, }, 2 + (level or 0)) end end ------------------------------------------------------------------------------- -- Checks that a wikitext gives the expected result after processing. -- @param message optional description of the test -- @example assertResultEquals("Hello world", "{{concat|Hello|world}}") function ScribuntoUnit:assertResultEquals(expected, text, message) local frame = self.frame local actual = frame:preprocess(text) if expected ~= actual then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s equals expected %s after preprocessing", text, tostring(expected)), actual = actual, actualRaw = text, expected = expected, message = message, }, 2) end end ------------------------------------------------------------------------------- -- Checks that two wikitexts give the same result after processing. -- @param message optional description of the test -- @example assertSameResult("{{concat|Hello|world}}", "{{deleteLastChar|Hello world!}}") function ScribuntoUnit:assertSameResult(text1, text2, message) local frame = self.frame local processed1 = frame:preprocess(text1) local processed2 = frame:preprocess(text2) if processed1 ~= processed2 then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s equals expected %s after preprocessing", processed1, processed2), actual = processed1, actualRaw = text1, expected = processed2, expectedRaw = text2, message = message, }, 2) end end ------------------------------------------------------------------------------- -- Checks that a parser function gives the expected output. -- @param message optional description of the test -- @example assertParserFunctionEquals("Hello world", "msg:concat", {"Hello", " world"}) function ScribuntoUnit:assertParserFunctionEquals(expected, pfname, args, message) local frame = self.frame local actual = frame:callParserFunction{ name = pfname, args = args} if expected ~= actual then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s with args %s equals expected %s after preprocessing", DebugHelper.concatWithKeys(args), pfname, expected), actual = actual, actualRaw = pfname, expected = expected, message = message, }, 2) end end ------------------------------------------------------------------------------- -- Checks that a template gives the expected output. -- @param message optional description of the test -- @example assertTemplateEquals("Hello world", "concat", {"Hello", " world"}) function ScribuntoUnit:assertTemplateEquals(expected, template, args, message) local frame = self.frame local actual = frame:expandTemplate{ title = template, args = args} if expected ~= actual then DebugHelper.raise({ ScribuntoUnit = true, text = string.format("Failed to assert that %s with args %s equals expected %s after preprocessing", DebugHelper.concatWithKeys(args), template, expected), actual = actual, actualRaw = template, expected = expected, message = message, }, 2) end end ------------------------------------------------------------------------------- -- Checks whether a function throws an error -- @param fn the function to test -- @param expectedMessage optional the expected error message -- @param message optional description of the test -- @param varargs optional arguments to be passed to fn function ScribuntoUnit:assertThrows(fn, expectedMessage, message, ...) local succeeded, actualMessage = pcall(fn, ...) if succeeded then DebugHelper.raise({ ScribuntoUnit = true, text = 'Expected exception but none was thrown', message = message, }, 2) end -- For strings, strip the line number added to the error message actualMessage = type(actualMessage) == 'string' and string.match(actualMessage, 'Module:[^:]*:[0-9]*: (.*)') or actualMessage local messagesMatch = DebugHelper.deepCompare(expectedMessage, actualMessage) if expectedMessage and not messagesMatch then DebugHelper.raise({ ScribuntoUnit = true, expected = expectedMessage, actual = actualMessage, text = string.format('Expected exception with message %s, but got message %s', tostring(expectedMessage), tostring(actualMessage) ), message = message }, 2) end end ------------------------------------------------------------------------------- -- Checks whether a function doesn't throw an error -- @param fn the function to test -- @param message optional description of the test -- @param varargs optional arguments to be passed to fn function ScribuntoUnit:assertDoesNotThrow(fn, message, ...) local succeeded, actualMessage = pcall(fn, ...) if succeeded then return end -- For strings, strip the line number added to the error message actualMessage = type(actualMessage) == 'string' and string.match(actualMessage, 'Module:[^:]*:[0-9]*: (.*)') or actualMessage DebugHelper.raise({ ScribuntoUnit = true, actual = actualMessage, text = string.format('Expected no exception, but got exception with message %s', tostring(actualMessage) ), message = message }, 2) end ------------------------------------------------------------------------------- -- Set up metatable ScribuntoUnit.__meta.__index = ScribuntoUnit function ScribuntoUnit.__meta:__newindex(key, value) if type(key) == "string" and key:find('^test') and type(value) == "function" then -- Store test functions in the order they were defined table.insert(self._tests, {name = key, test = value}) else rawset(self, key, value) end end ------------------------------------------------------------------------------- -- Creates a new test suite. -- function ScribuntoUnit.new() local self = {} self._tests = {} setmetatable(self, ScribuntoUnit.__meta) self.run = function(frame) return ScribuntoUnit.run(self, frame) end return self end ------------------------------------------------------------------------------- -- Resets global counters -- function ScribuntoUnit:init(frame) self.frame = frame or mw.getCurrentFrame() self.successCount = 0 self.failureCount = 0 self.skipCount = 0 self.results = {} end ------------------------------------------------------------------------------- -- Runs a single testcase -- @param name test nume -- @param test function containing assertions -- function ScribuntoUnit:runTest(name, test) local success, details = pcall(test, self) if success then self.successCount = self.successCount + 1 table.insert(self.results, {name = name, success = true}) elseif type(details) ~= 'table' or not details.ScribuntoUnit then -- a real error, not a failed assertion self.failureCount = self.failureCount + 1 table.insert(self.results, {name = name, error = true, message = 'Lua error -- ' .. tostring(details)}) elseif details.skipped then self.skipCount = self.skipCount + 1 table.insert(self.results, {name = name, skipped = true}) else self.failureCount = self.failureCount + 1 local message = details.source or "" if details.message then message = message .. details.message .. "\n" end message = message .. details.text table.insert(self.results, {name = name, error = true, message = message, expected = details.expected, actual = details.actual, testname = details.message}) end end ------------------------------------------------------------------------------- -- Runs all tests and displays the results. -- function ScribuntoUnit:runSuite(frame) self:init(frame) for i, testDetails in ipairs(self._tests) do self:runTest(testDetails.name, testDetails.test) end return { successCount = self.successCount, failureCount = self.failureCount, skipCount = self.skipCount, results = self.results, } end ------------------------------------------------------------------------------- -- #invoke entry point for running the tests. -- Can be called without a frame, in which case it will use mw.log for output -- @param displayMode see displayResults() -- function ScribuntoUnit:run(frame) local testData = self:runSuite(frame) if frame and frame.args then return self:displayResults(testData, frame.args.displayMode or 'table') else return self:displayResults(testData, 'log') end end ------------------------------------------------------------------------------- -- Displays test results -- @param displayMode: 'table', 'log' or 'short' -- function ScribuntoUnit:displayResults(testData, displayMode) if displayMode == 'table' then return self:displayResultsAsTable(testData) elseif displayMode == 'log' then return self:displayResultsAsLog(testData) elseif displayMode == 'short' then return self:displayResultsAsShort(testData) elseif displayMode == 'enum' then return self:displayResultsAsEnum(testData) else error('unknown display mode') end end function ScribuntoUnit:displayResultsAsLog(testData) if testData.failureCount > 0 then mw.log('FAILURES!!!') elseif testData.skipCount > 0 then mw.log('Some tests could not be executed without a frame and have been skipped. Invoke this test suite as a template to run all tests.') end mw.log(string.format('Assertions: success: %d, error: %d, skipped: %d', testData.successCount, testData.failureCount, testData.skipCount)) mw.log('-------------------------------------------------------------------------------') for _, result in ipairs(testData.results) do if result.error then mw.log(string.format('%s: %s', result.name, result.message)) end end end function ScribuntoUnit:displayResultsAsShort(testData) local text = string.format(cfg.shortResultsFormat, testData.successCount, testData.failureCount, testData.skipCount) if testData.failureCount > 0 then text = '<span class="error">' .. text .. '</span>' end return text end function ScribuntoUnit:displayResultsAsEnum(testData) if (testData.failureCount > 0) then return 'fail' elseif (testData.skipCount > 0 and testData.successCount == 0) then return 'skipped' else return 'success' end end function ScribuntoUnit:displayResultsAsTable(testData) local successIcon, failIcon = self.frame:preprocess(cfg.successIndicator), self.frame:preprocess(cfg.failureIndicator) local text = '' if testData.failureCount > 0 then local msg = mw.message.newRawMessage(cfg.failureSummary, testData.failureCount):plain() msg = self.frame:preprocess(msg) if cfg.failureCategory then msg = cfg.failureCategory .. msg end text = text .. failIcon .. ' ' .. msg .. '\n' else text = text .. successIcon .. ' ' .. cfg.successSummary .. '\n' end text = text .. '{| class="wikitable scribunto-test-table"\n' text = text .. '!\n! ' .. cfg.nameString .. '\n! ' .. cfg.expectedString .. '\n! ' .. cfg.actualString .. '\n' for _, result in ipairs(testData.results) do text = text .. '|-\n' if result.error then text = text .. '| ' .. failIcon .. '\n| ' if (result.expected and result.actual) then local name = result.name if result.testname then name = name .. ' / ' .. result.testname end text = text .. mw.text.nowiki(name) .. '\n| ' .. mw.text.nowiki(tostring(result.expected)) .. '\n| ' .. mw.text.nowiki(tostring(result.actual)) .. '\n' else text = text .. mw.text.nowiki(result.name) .. '\n| ' .. ' colspan="2" | ' .. mw.text.nowiki(result.message) .. '\n' end else text = text .. '| ' .. successIcon .. '\n| ' .. mw.text.nowiki(result.name) .. '\n|\n|\n' end end text = text .. '|}\n' return text end return ScribuntoUnit 6ndvyy4oz3v3i8fjoxts3ofs01uwk3h Modul:ScribuntoUnit/config 828 108828 712198 2026-08-22T09:00:07Z Nimmzo 37272 [[:en:Module:ScribuntoUnit/config]] localisable strings. Caller: [[Modul:ScribuntoUnit]] 712198 Scribunto text/plain -- The cfg table, created by this module, contains all localisable strings and -- configuration, to make it easier to port this module to another wiki. local cfg = {} -- Do not edit this line. -- The successIndicator and failureIndicator are in the first column of the -- wikitable produced as output and indicate whether the test passed. These two -- strings are preprocessed by frame.preprocess. -- successIndicator: if the test passes -- failureIndicator: if the test fails cfg.successIndicator = "{{tick}}" cfg.failureIndicator = "{{cross}}" -- The names of the columns Name, Expected and Actual (the other three columns, -- in this order) cfg.nameString = "Name" cfg.expectedString = "Expected" cfg.actualString = "Actual" -- The string at the top used to indicate all tests passed. cfg.successSummary = "All tests passed." -- The string at the top used to indicate one or more tests failed. $1 is -- replaced by the number of tests that failed. This string is preprocessed by -- frame.preprocess. cfg.failureSummary = "'''$1 {{PLURAL:$1|test|tests}} failed'''." -- Format string for a short display of the tests in displayResultsAsShort. -- This format string is passed directly to string.format. cfg.shortResultsFormat = "success: %d, error: %d, skipped: %d" -- Category added to pages that fail one or more tests. Set to nil to disable -- categorisation of pages that fail one or more tests. cfg.failureCategory = "[[Category:Failed Lua testcases using Module:ScribuntoUnit]]" -- Finally, return the configuration table. return cfg -- Do not edit this line. oocd1sl459mwsdylkxl8dxfudn74htq