Hello, world!
Good bye, friend!
Rocketeer
模組:Test[]
local p = {}
function p.hello()
return "Hello, world!"
end
function p.bye()
return "Good bye, friend!"
end
function p.TankID(tankID)
--不一定用tankID,用其他變數名稱也行
--此處傳入的是陣列,用tankID.args取回
--若是未指定名稱的參數,則用tankID.args[1]取回
--ex: {{#invoke:test|TankID|60}}
local ID = tankID.args['ID']
-- {{#invoke:test|TankID|ID=60}}
local tanks={"Tank","Twin","Triplet","Triple Shot","Quad Tank","Octo Tank","Sniper","Machine Gun","Machine Gun II","Flank Guard","Tri-Angle","Mega Destroter","Destroyer","Overseer","Overlord","Twin Flank","Penta Shot","Assassin","Arena Closer","Necromancer","Triple Twin","Hunter'","Gunner","Stalker","Ranger","Destoryer Dominator","Booster","Fighte","Hybrid","Manager","Mothership","X Hunter","Predator","Sprayer","Trapper","Gunner Trapper","Overtrapper","Mega Trapper","Tri-Trapper","Smasher","Mega Smasher","Landmine","Auto Gunner","Auto 4","Auto 5","Auto 3","Spread Shot","Streamliner","Auto Trapper","Gunner Dominator","Trapper Dominator","Battleship","Annihilator","Auto Smasher","Spike","Factory","Mounted Turret","Ball","Skimmer","Rocketeer"}
--外部進來的都是字串,如果要用數字必須先轉型
--下行:若ID非null則進行型別轉換
if ID then ID = tonumber(ID) end
--同上
if ID and tanks[ID] then
return tanks[ID]
else
return "無編號"..ID.."坦克,請確認輸入無誤"
end
end
return p