Anasayfa
Rastgele
Oturum aç
Ayarlar
Sanarşiv hakkında
Sorumluluk reddi
Ara
"
Modül:Örnek/deneme
" sayfasını değiştirmektesiniz
Uyarı:
Oturum açmadınız. Bir düzenleme yaptığınızda, sizin için geçici bir hesap oluşturulur.
Daha fazla bilgi
. Bu hesabın süresi dolduğunda bildirimler almaya devam etmek ve diğer özelliklere erişmek için
oturum açın
ya da
hesap oluşturun
.
Anti spam denetimi. Bunu
doldurmayın
!
local p = {}; --All lua modules on Sanarsiv must begin by defining a variable --that will hold their externally accessible functions. --Such variables can have whatever name you want and may --also contain various data as well as functions. p.merhaba = function( frame ) --Add a function to "p". --Such functions are callable in Sanarsiv --via the #invoke command. --"frame" will contain the data that Sanarsiv --sends this function when it runs. -- 'Hello' is a name of your choice. The same name needs to be referred to when the module is used. local str = "Merhaba dünya!" --Declare a local variable and set it equal to --"Hello World!". return str --This tells us to quit this function and send the information in --"str" back to Sanarsiv. end -- end of the function "hello" function p.merhaba_sana(frame) -- Add another function local name = frame.args[1] -- To access arguments passed to a module, use `frame.args` -- `frame.args[1]` refers to the first unnamed parameter -- given to the module return "Merhaba, " .. name .. "!" -- `..` concatenates strings. This will return a customized -- greeting depending on the name given, such as "Hello, Fred!" end function p.meyve_say(frame) local num_bananas = frame.args.muzlar -- Named arguments ({{#invoke:Example|count_fruit|foo=bar}}) are likewise local num_apples = frame.args.elmalar -- accessed by indexing `frame.args` by name (`frame.args["bananas"]`, or) -- equivalently `frame.args.bananas`. return '' .. num_bananas .. ' muzum ve ' .. num_apples .. ' elmam var.' -- Like above, concatenate a bunch of strings together to produce -- a sentence based on the arguments given. end -- -- orjinalindeki lucky ve name2 fonksiyonları çevrilmedi, bkz. enwiki, Module:Example -- return p --All modules end by returning the variable containing their functions to Sanarsiv. -- Now we can use this module by calling {{#invoke: Example | hello }}, -- {{#invoke: Example | hello_to | foo }}, or {{#invoke:Example|count_fruit|bananas=5|apples=6}} -- Note that the first part of the invoke is the name of the Module's wikipage, -- and the second part is the name of one of the functions attached to the -- variable that you returned. -- The "print" function is not allowed in Sanarsiv. All output is accomplished -- via strings "returned" to Sanarsiv.
Özet:
Sanarşiv web sitesine yapılan tüm katkıların diğer katılımcılar tarafından düzenlenebileceğini, değiştirilebileceğini veya kaldırılabileceğini lütfen unutmayın. Yazınızın acımasızca düzenlenmesini istemiyorsanız, buraya göndermeyin.
Ayrıca, bunu kendiniz yazdığınızı veya herkese açık bir alandan veya benzeri ücretsiz bir kaynaktan kopyaladığınıza söz veriyorsunuz (ayrıntılar için
Sanarşiv:Telif hakları
sayfasına bakın).
Telif hakkıyla korunan eseri izinsiz göndermeyin!
İptal
Değişiklik yardımı
(yeni pencerede açılır)
Bu sayfada yer alan sayfa:
Modül:Örnek/deneme/belge
(
değiştir
)