Lompat ke isi

Wikipedia:Lua

Ti Wikipédia Sunda, énsiklopédi bébas
 WP:Lua
Project
 WT:Lua
Project talk
 Modules
 
 Help
 
 To do
 
 Requests
 
 Resources
en: m: mw: external
 
Ngaranspasi Wikipedia
Subyék ngaranspasi Obrolan ngaranspasi
0 (Utama/Artikel) Obrolan 1
2 Pamaké Obrolan pamaké 3
4 Wikipedia Obrolan Wikipedia 5
6 Gambar Obrolan gambar 7
8 MédiaWiki Obrolan MédiaWiki 9
10 Citakan Obrolan citakan 11
12 Pitulung Obrolan pitulung 13
14 Kategori Obrolan kategori 15
100 Portal Obrolan portal 101
108 [[Wikipedia:Books|]] [[Pitulung:Maké kaca obrolan|]] 109
118 [[Wikipedia:Drafts|]] [[Pitulung:Maké kaca obrolan|]] 119
446 [[Wikipedia:Kaca kursus|]] [[Pitulung:Maké kaca obrolan|]] 447
710 TimedText TimedText talk 711
828 Modul Pembicaraan Modul 829
2600 [[Wikipedia:Flow|]]
Ngaranspasi virtual
-1 Husus
-2 Média

Lua mangrupakeun basa pamrograman nu ayeuna geus sadia di Wikipedia Sunda ngaliwatan ekstensi MediaWiki Scribunto.
Kode Lua ayeuna bisa diasupkeun kana témplat wiki ku maké fungsi parser {{#invoke:}} dina kaca pamaké anjeun.

Halo, dunya! dina Lua

[édit sumber]

The Lua source code is stored in a wiki page with the prefix Modul: (e.g., Modul:Bananas). These individual modules are then invoked (by code {{#invoke:}}) on another wiki page (e.g., Modul:Bananas/doc uses the code {{#invoke:Bananas|hello}} to print the text "Hello, world!").

Modules are run on normal wiki pages using the #invoke parser function. The syntax of #invoke 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.[1]

This is much like what a template does: you give it arguments, it processes them, and you get a result.
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:

  1. We can't run a module by itself.
  2. 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:

{{#invoke:NgaranModul|ngaranFungsi}}

For example, Modul:Bananas is the simplest possible script, providing a single function with no arguments.
The function is named hello in lowercase. We can run this module in this way.

Anjeun teu kudu masang atawa nyimpen nanaon.

  1. Édit kaca pamaké anjeun.
  2. Témpélkeun panggilan di handap ieu dina awal hiji baris anyar dina kaca pamaké anjeun:
{{#invoke:Bananas|hello}}
  1. Klik Témbongkeun sawangan. Panggilan fungsi hello dina Modul:Bananas diganti ku ieu di handap: Halo, dunya!
Hello, world!
  1. Klik Bolay. Lamun dipenta, klik Tinggalkeun.
  2. Kaca pamaké anjeun tetep teu dirobah.

Using arguments

[édit sumber]

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 | is always the function name; the first positional argument is the text after the second pipe.

{{#invoke:NgaranModul|ngaranFungsi|arguménPosisional1}}

For example, another Modul:BananasArgs demonstrates how to access and use parameters.
The hello function greets different people depending on the first positional argument. It works like this:

Dina kaca pamaké anjeun:

# {{#invoke:BananasArgs|hello|Mariam}}
# {{#invoke:BananasArgs|hello|Mohamed}}
  1. Hello, Mariam!
  2. Hello, Mohamed!
Named arguments key=value
{{#invoke:NgaranModul|ngaranFungsi|argNgaran1=nilai1|argNgaran2=nilai2}}

The Modul:BananasArgs also has a function named count_fruit which uses the named arguments bananas and apples to count the number of bananas and apples we have. It can be run switching the order of the parameters:

Dina kaca pamaké anjeun:

# {{#invoke:BananasArgs|count_fruit|apples=3|bananas=4}}
# {{#invoke:BananasArgs|count_fruit|bananas=5|apples=2}}
  1. I have 4 bananas and 3 apples
  2. I have 5 bananas and 2 apples

Most modules have a documentation page explaining what arguments can be used and what their effects will be.

Konsol debug: Mimiti diajar Lua

[édit sumber]

Debug Console dina Lua Scribunto nyaéta alat anu aman tur interaktif pikeun diajar Lua dina Wikipedia.

  1. Klik Témbongkeun sumber dina kaca Modul:Yesno.
  2. Gulung ka handap kaca nepi ka bagian Debug console.
  3. Témpélkeun komentar jeung panggilan kana kotak asup kulawu (di luhur tombol Kosongkan).
--[[Program Lua munggaran anjeun nu mirip Hello World]]--
print("Wilujeng sumping di " .. _VERSION .. "!") -- Ngarangkep vérsi Lua ku `..`
  1. Pencét ↵ Enter sakali pikeun ngalaksanakeun dua paréntah Lua éta.
  2. Hasilna bakal muncul di handap garis paréntah Lua print:
Wilujeng sumping di Lua 5.1!
  1. Pencét ↑ Panah ka luhur pikeun ngurilingan paréntah Lua saméméhna.
  2. Opsional, klik Kosongkan pikeun ngaberesihan ngan Debug Console; éditor Lua di luhur moal teu robah.


Generator HTML dina Debug console

Panggil pungsi hello dina Modul:Bananas:

local modCau = require('Modul:Bananas') -- muat modul dina Debug console
print(modCau.hello()) -- tampilkeun "Hello, world!"
Hello, world!
Argumén
local modCau = require('Modul:BananasArgs')
local frame = mw.getCurrentFrame()
frame.args = {"Mariam"};  print(modCau.hello(frame)) -- "Hello, Mariam!"
frame.args = {"Mohamed"}; print(modCau.hello(frame))
frame.args = {apples="3", bananas="4"}; print(modCau.count_fruit(frame))
frame.args = {bananas="5", apples="2"}; print(modCau.count_fruit(frame))
Hello, Mariam!
Hello, Mohamed!
I have 4 bananas and 3 apples
I have 5 bananas and 2 apples


Fungsi idéntitas

callParserFunction #if

local yesno = require('Modul:Yesno') -- #if yesno teras mulangkeun parameter asupanna
local frame = mw.getCurrentFrame()
print(frame:callParserFunction("#if", yesno("Yes"), "Yes", 'henteu'))
print(frame:callParserFunction("#if", yesno('teu'), "Leres", 'teu'))
Yes
teu
  1. Tutup Modul:Yesno anu dijaga anu tetep teu robah.

Request a script

[édit sumber]

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

[édit sumber]

Sordid history. ParserFunctions, Lua extension, wiki scripting language debated (JavaScript v. Lua), mw:Extension:WikiScripts, Tim writes Scribunto with initial support for Lua.

Discussed for years, Lua was installed in 2012 for testing on 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

[édit sumber]
See also 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 hello function contained in Modul:Bananas:

--[[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.

A sample of Lua is highlighted by tag <syntaxhighlight lang="lua" line highlight=1 copy> ... </syntaxhighlight> 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

[édit sumber]

A unit testing framework for Lua scripts on Wikipedia is available at Modul:ScribuntoUnit.
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 Modul:Bananas are placed in Modul: Bananas/testcases.
They are executed on Pembicaraan Modul:Bananas/testcases with {{#invoke:Bananas/testcases|run}}.

Dina kaca pamaké anjeun:

{{#invoke:Bananas/testcases|run}}

YaY Sakabéh tés lulus.

Ngaran Diarepkeun Saleresna
YaY test_halo

Each test method must begin with p:test_.

An example from Modul:Bananas/testcases is below.

--[[Modul:Bananas/testcases]]--
local p = require('Modul:ScribuntoUnit').new()
local modCau = require('Modul:Bananas') -- Didatangan kaca obrolan pikeun ngajalankeun tés.
function p:test_halo() -- Tés unit pikeun [[Modul:Bananas]].
    self:assertEquals('Hello, world!', modCau.hello())
end 
return p
Prinsip uji hijian

Di konsol debug modul:Yesno:

local self = {
    assertEquals = function(_, wikitext, expected)
        local got = mw.getCurrentFrame():preprocess(wikitext)
        print('"' .. expected .. '": Diarepkeun')
        print('"' .. got      .. '": Saleresna')
        return got == expected
    end
}
-- Pamisah `:` tanpa `self`
print(self:assertEquals(      '{{#invoke:Bananas|hello}}', 'Hello, world!'))
-- Pamisah `.` jeung `self`
print(self.assertEquals(self, '{{#invoke:Bananas|hello}}', 'Hello, world!'))
"Hello, world!": Diarepkeun
"Hello, world!": Sakuduna
true
"Hello, world!": Diarepkeun
"Hello, world!": Sakuduna
true


local modTest = require('Modul:Bananas/testcases')
print(modTest.run(mw.getCurrentFrame()))

Lamun tésna hasil, nilai anu diarepkeun jeung nilai sabenerna teu dipintonkeun supaya tabel hasil jadi leuwih basajan:

[[File:Yes check.svg|20px|alt=Ya|link=]]<span style="display:none">Y</span> Sakabéh tés lulus.
{| class="wikitable scribunto-test-table"
!
! Ngaran
! Diarepkeun
! Saleresna
|-
| [[File:Yes check.svg|20px|alt=Ya|link=]]<span style="display:none">Y</span>
| test_halo
|
|
|}

Ngajalankeun Modul:ScribuntoUnit langsung dina Modul:Bananas tanpa nyimpen Modul:Bananas/testcases:

local modTest = require('Modul:ScribuntoUnit').new()
local modCau  = require('Modul:Bananas')
function modTest:test_halo() self:assertEquals('Hello, world!', modCau.hello()) end
print(modTest.run(mw.getCurrentFrame()))

HTML anu dihasilkeun sarua.

Modul:ScribuntoUnit originates from Hungarian Wikipedia.
It throws real errors that are trapped using protected calls. It also has a method to compare floats within a given precision.

Pikeun daptar sakabéh modul nu ngagunakeun tés unit, tingali nu dipaké.

Wikipedia-specific features

[édit sumber]

Overall: Lua can only get input as text strings passed to the {{#invoke:}} 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 and parser functions in the output will not work correctly.

Langkung hade ngagunakeun fungsi mw.ustring.len tibatan string.len:

Di konsol debug modul:Yesno:

--[[Alfabét Latin]]--
local content_lang = mw.getContentLanguage().code -- su
local lang = mw.getCurrentFrame():callParserFunction("#language", content_lang)
local lenUnicode, lenByte, lenSharp = mw.ustring.len(lang), string.len(lang), #lang
print(("lang: \"%s\". Mw.ustring.len = %d String.len = %d Sharp = %d"):format(lang, lenUnicode, lenByte, lenSharp))

--[[Unicode]]--
lang = "اَكسارا ڤَيڮَون" -- Aksara Pégon
lenUnicode, lenByte, lenSharp = mw.ustring.len(lang), string.len(lang), #lang
print(("lang: \"%s\". Mw.ustring.len = %d String.len = %d Sharp = %d"):format(lang, lenUnicode, lenByte, lenSharp))

Konsol debug ngarojong Unicode, tapi henteu ngarojong téks katuhu-ka-kenca:

lang: "Sunda". Mw.ustring.len = 5 String.len = 5 Sharp = 5
lang: "اَكسارا ڤَيڮَون". Mw.ustring.len = 15 String.len = 29 Sharp = 29
Alfabét Latin Aksara Arah Jumlah karakter Panjang dina bait
Sunda Basa Sunda. → kenca ka katuhu. 5 5
Hurup Pégon اَكسارا ڤَيڮَون. ← Katuhu ka kenca 15 (Unicode) + 1 titik 29 + 1
number of
octet:s : 30


index 0
beg code $D8=#216
length 2
extra $A7
codepoint U+$0627
dec #1'575
 ا 
index 2
beg code $D9=#217
length 2
extra $8E
codepoint U+$064E
dec #1'614
 َ 
index 4
beg code $D9=#217
length 2
extra $83
codepoint U+$0643
dec #1'603
 ك 
index 6
beg code $D8=#216
length 2
extra $B3
codepoint U+$0633
dec #1'587
 س 
index 8
beg code $D8=#216
length 2
extra $A7
codepoint U+$0627
dec #1'575
 ا 
index 10
beg code $D8=#216
length 2
extra $B1
codepoint U+$0631
dec #1'585
 ر 
index 12
beg code $D8=#216
length 2
extra $A7
codepoint U+$0627
dec #1'575
 ا 
index 14
beg code $20=#32
length 1
SPACE
index 15
beg code $DA=#218
length 2
extra $A4
codepoint U+$06A4
dec #1'700
 ڤ 
index 17
beg code $D9=#217
length 2
extra $8E
codepoint U+$064E
dec #1'614
 َ 
index 19
beg code $D9=#217
length 2
extra $8A
codepoint U+$064A
dec #1'610
 ي 
index 21
beg code $DA=#218
length 2
extra $AE
codepoint U+$06AE
dec #1'710
 ڮ 
index 23
beg code $D9=#217
length 2
extra $8E
codepoint U+$064E
dec #1'614
 َ 
index 25
beg code $D9=#217
length 2
extra $88
codepoint U+$0648
dec #1'608
 و 
index 27
beg code $D9=#217
length 2
extra $86
codepoint U+$0646
dec #1'606
 ن 
index 29
beg code $2E=#46
length 1
 . 


number of UTF8
char:s : 16


Lua code in a wiki 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).

Relative to standard Lua, Scribunto offers safe functions (see the differences from standard Lua).

Lua input limitations

[édit sumber]

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 an input box that allows you to type a Fahrenheit temperature and get back the corresponding Celsius temperature when you press a button, or recalculate a piece of the Mandelbrot set depending on which part of the parent set you click on.

Dina konsol debug modul:Yesno:

local function toCelsius(tempFahrenheit) return (tempFahrenheit - 32) * 5 / 9 end
print(("toCelsius(32°F) = %s°C. toCelsius(68°F) = %d°C"):format(toCelsius(32), toCelsius(68)))
toCelsius(32°F) = 0°C. toCelsius(68°F) = 20°C

The Lua input can be any Wikipedia text page that can be transcluded (included on another page). This does not include graphics files (not even .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 category, nor the contents of non-transcludeable special pages.

Wikitext

[édit sumber]

Transcluded Wikipedia headers frequently contain a hidden code such as "UNIQ5ae8f2aa414ff233-h-3--QINU" which may need to be stripped out in order for them to be parsed effectively.

print(string.reverse("UNIQ")) -- Urutan sabalikna tina "UNIQ" nyaéta "QINU"
QINU

Wikilinks of the type [[Wikipedia:Pitulung|]] won't work if returned as output - they need to be written explicitly as [[Wikipedia:Pitulung|Pitulung]]. Other pre-save transforms, such as replacing ~~~~ with signatures, will also fail to be processed. Template transclusions, parser function calls, and variable substitutions (i.e. anything with a {{...}}) will not be processed, nor will tags such as <ref> or <nowiki>.

Debugging

[édit sumber]
Galat nu katingali dina kaca

Kaca wiki Jatisura, Cikedung, Indramayu ngahasilkeun dua galat:

Modul:Navbar Judul teu valid
Désa Jatisura
Kalurahan/Désa

Peta lokasi Kalurahan Jatisura
Nagara Indonésia
PropinsiJawa Barat
KabupaténIndramayu
KacamatanCikedung

Jatisura nyaéta salah sahiji désa di kacamatan Cikedung, Kabupatén Indramayu, Propinsi Jawa Barat, Indonésia.


  1. Citakan:Kotakinfo Kalurahan nyaur Citakan:Infobox settlement ku parameter nu teu dipikawanoh |coordinates_display= jeung |other_code_type= (pratayang).
  2. Galat Lua dina Modul:Navbar di baris 58: Judul teu valid , {{{kota}}}.


Ngurangan masalah

Pikeun misahkeun galat Lua, uji Citakan:Cikedung, Indramayu:

Daptar 17 kaca nu kapangaruhan ku ieu masalah: Husus:NumbuKaDieu/Citakan:Cikedung, Indramayu

Ngaréka ulang dina Modul:Yesno

Dina konsol debug modul:Yesno:

local wikitext="{{Cikedung, Indramayu}}"
print(mw.getCurrentFrame():preprocess(wikitext))
<strong class="error"><span class="scribunto-error mw-scribunto-error-e20d3541">Lua error in Modul:Navbar at line 58: Invalid title , {{{kota}}}.</span></strong>
Mariksa Modul:Navbar

Kode patali dina Modul:Navbar#L-58 nyaéta:

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
	
	local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
	if not title then
		error(cfg.invalid_title .. title_text)
	end

Nambahkeun tanda petik dina title_text mah opsional pikeun ngagampangkeun pesen galat.

  1. Pasang title_text dina tanda petik.
  2. PANGJAOAN: ULAH ngaklik "Pedalkeun parobahan" ("Publish changes").
local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
	
	local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
	if not title then error(cfg.invalid_title .. "\"" .. title_text .. "\"")
		error(cfg.invalid_title ..  title_text)
	end
Uji dina preview

Dina kaca preview, pake template ieu:

  1. Témpélkeun Pratayang halaman dengan templat ini (caller template):
Jatisura, Cikedung, Indramayu
  1. Klik Lihat pratayang (Show preview)

Pesen galat jadi:

Lua error in Modul:Navbar at line 57: Invalid title ", {{{kota}}}".

Ieu nuduhkeun yén koma ", " aya dina judul nu salah, nyaéta , {{{kota}}}.

Ngalenyepan caller

Pikeun nyaho template nu nelepon, lebetkeun:

local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style)
	
	local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace)
	if not title then error("Caller: \"" .. mw.getCurrentFrame():getParent():getTitle() .. "\"")
		error(cfg.invalid_title ..  title_text)
	end

Sanggeus then, témpélkeun:

error("Caller: \"" .. mw.getCurrentFrame():getParent():getTitle() .. "\"")

Pesen galat jadi:

Lua error in Modul:Navbar at line 57: Caller: "Citakan:Navbox".


Akar masalah

Citakan:kac-2 dialihkeun ka Citakan:Navigasi ID Desa, jadi bugna lain dina modul Lua, tapi dina parameter nu dipake ku caller.

Dina konsol debug modul:Yesno:

local wikitext="{{kac-2 |propinsi=Jawa Barat |dati2=Kabupatén |nami dati2=Indramayu}}"
print(mw.getCurrentFrame():preprocess(wikitext))

Parameter Sunda |nami dati2= teu dipaliré sabab modul Lua ngarepkeun ngaran parameter dina basa Indonésia:

<strong class="error"><span class="scribunto-error mw-scribunto-error-e20d3541">Lua error in Modul:Navbar at line 58: Invalid title , {{{kota}}}.</span></strong>

Perhatikeun koma ", " dituturkeun ku {{{kota}}}.

Citakan:Navigasi ID Desa dimimitian ku:

<noinclude>{{gabungdari|Navigasi kampung}}</noinclude>
{{Navbox
|name       = {{{name<includeonly>|{{{nama kecamatan|{{{kecamatan|{{{distrik|{{{kapanewon|{{{kemantren|}}}}}}}}}}}}}}}, {{{nama dati2|{{{kabupaten|{{{kota}}}}}}}}}</includeonly><noinclude>|Navigasi ID Desa</noinclude>}}}

Jadi nilai standar |name= jadi runtah nu teu disangka, nyaéta , {{{kota}}}.

  1. Upami argumén kemantren ditetepkeun, mulangkeun nilaina; upami henteu, mulangkeun runtuyan kosong.
  2. Ngahasilkeun koma tuluy spasi.
  3. Upami argumén nama dati2 ditetepkeun, mulangkeun nilaina;
  4. upami henteu, upami kabupaten ditetepkeun, mulangkeun nilaina; upami henteu, mulangkeun {{{kota}}}


Dina konsol debug modul:Yesno:

local wikitext="{{{kemantren|}}}, {{{nama dati2|{{{kabupaten|{{{kota}}}}}}}}}"
print(mw.getCurrentFrame():preprocess(wikitext))

Henteu aya argumén anu ditetepkeun.

, {{{kota}}}
Pemetaan parameter

Sintésis

Sunda Indonésia Inggris
nami nama name
propinsi provinsi province
nami kacamatan nama kecamatan name of the district
Citakan:Kotakinfo Kalurahan Citakan:Navigasi ID Desa Citakan:Navbox
Solusi

Pake ngaran parameter basa Indonésia dina caller supaya teu kudu ngarobah modul Lua:

local wikitext="{{kac-2 |provinsi=Jawa Kulon |dati2=Kabupatén |kabupaten=Indramayu |nama kecamatan=Cikedung}}"
print(mw.getCurrentFrame():preprocess(wikitext))

HTML navbox hasilna hasil dibangkitkeun kalawan suksés:

<div class="navbox-styles"><DEL>'"`UNIQ--templatestyles-00000006-QINU`"'<DEL><DEL>'"`UNIQ--templatestyles-00000000-QINU`"'<DEL></div><div role="navigation" class="navbox" aria-labelledby="Kecamatan_Cikedung,_Kabupatén_Indramayu,_Jawa_Kulon" style="padding:3px"><table class="nowraplinks mw-collapsible manualcollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tr><th scope="col" class="navbox-title" colspan="2"><DEL>'"`UNIQ--templatestyles-00000002-QINU`"'<DEL><DEL>'"`UNIQ--templatestyles-00000004-QINU`"'<DEL><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-lihat">[[Citakan:Cikedung, Indramayu|<abbr title="Lihat templat ini">l</abbr>]]</li><li class="nv-bicara">[[Obrolan citakan:Cikedung, Indramayu|<abbr title="Diskusikan templat ini">b</abbr>]]</li><li class="nv-sunting">[//su.wikipedia.org/w/index.php?title=Citakan:Cikedung,_Indramayu&action=edit<abbr title="Sunting templat ini">s</abbr>]</li></ul></div><div id="Kecamatan_Cikedung,_Kabupatén_Indramayu,_Jawa_Kulon" style="font-size:114%;margin:0 4em">[[Cikedung, Indramayu|Kecamatan Cikedung]], [[Kabupatén Indramayu]], [[Jawa Kulon]]</div></th></tr></table></div>


Citakan:Cikedung, Indramayu dimimitian ku:

{{kac-2 |propinsi=Jawa Barat |dati2=Kabupatén |nami dati2=Indramayu |nami kacamatan=Cikedung}}

Dina konsol debug modul:Yesno:

local frame = mw.getCurrentFrame()
local argSundanese  = {propinsi='Jawa Barat', dati2='Kabupatén', ["nami dati2"]='Indramayu', ["nami kacamatan"]='Cikedung'}
print("1. KO: " .. frame:expandTemplate{title="kac-2", args=argSundanese}) -- fails
local argIndonesian = {provinsi='Jawa Kulon', dati2='Kabupatén', kabupaten     ='Indramayu', ["nama kecamatan"]='Cikedung'}
print("2. OK: " .. frame:expandTemplate{title="kac-2", args=argIndonesian}) -- works

Dina kaca pamaké anjeun:

1. {{cross}}: {{kac-2 |propinsi=Jawa Barat |dati2=Kabupatén |nami dati2=Indramayu |nami kacamatan=Cikedung}}<br />
2. {{tick}}:  {{kac-2 |provinsi=Jawa Kulon |dati2=Kabupatén |kabupaten=Indramayu  |nama kecamatan=Cikedung}}

1. :


2. Ya:

Labeling converted templates

[édit sumber]

Please place the {{lua}} template on the documentation subpage of all templates that use Lua. It will help to better communicate Lua usage and template conversions.

See also

[édit sumber]
English Wikipedia-specific resources
  1. ↑ You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.
 WP:Lua
Project
 WT:Lua
Project talk
 Modules
 
 Help
 
 To do
 
 Requests
 
 Resources
en: m: mw: external