ব্যবহারকারী:Rahul amin roktim/lua: সংশোধিত সংস্করণের মধ্যে পার্থক্য

বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
Rahul amin roktim (আলোচনা | অবদান)
সম্পাদনা সারাংশ নেই
Rahul amin roktim (আলোচনা | অবদান)
সম্পাদনা সারাংশ নেই
৪ নং লাইন:
{{#invoke:ConvertTime|main|১৬:২৫, ৩ এপ্রিল ২০১৩ (ইউটিসি)}}
<syntaxhighlight lang="lua">
 
local p = {}
 
function p.has_fruithello( frame )
-- Mixing regular args with named args and optional named args
return "Hello, world!"
-- Used like: {{#invoke:test|has_fruit|Fred|bananas=5|cherries=7}}
function p.has_fruit(frame)
local name = frame.args[1]
local num_bananas = frame.args.bananas
local num_apples = frame.args.apples
local num_cherries = frame.args.cherries
local result = name .. ' has:'
if num_bananas then result = result .. ' ' .. num_bananas .. ' bananas' end
if num_apples then result = result .. ' ' .. num_apples .. ' apples' end
if num_cherries then result = result .. ' ' .. num_cherries .. ' cherries' end
return result
end
 
function p.roktim(frame)
return "hello roktim!"
end
 
return resultp
-- how to use ? don't know ?
-- [[
{{#invoke:test2|hello}}
{{#invoke:test2|roktim}}
 
here #invoke: for call lua
test2 is page name
hello is function name
:)
---
when you call function you have to 'declare local p ={}' name space in wikipedia
 
 
]]
</syntaxhighlight>