Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/alex.osheter/listtest
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p.parseNames(frame) return frame [[local trackNames = frame.args[1] -- Comma separated names of tracks local output = "{{Track listing" counter = 1 for word in string.gmatch(trackNames, '([^, ]+)') do output = output .. " | title" .. counter .. " = " .. word counter = counter + 1 end output = output .. "}}" return output]]-- end function p.Name2(frame) -- This section is the core of the module. 'Name2' is a name of your choice. The same name needs to be referred to when the module is used. -- The next five lines are mostly for convenience only and can be used as is for your module. The output conditions start on line 20. local pf = frame:getParent().args -- This line allows template parameters to be used in this code easily. The equal sign is used to define variables. 'pf' can be replaced with a word of your choice. local f = frame.args -- This line allows parameters from {{#invoke:}} to be used easily. 'f' can be replaced with a word of your choice. local M = f[1] or pf[1] -- f[1] and pf[1], which we just defined, refer to the first parameter. This line shortens them as 'M' for convenience. You could use the original variable names. local m = f[2] or pf[2] -- Second shortened as 'm'. if m == nil then -- If the second parameter is not used. return 'Lonely' -- Outputs the string 'Lonely' if the first condition is met. else return 'Be positive!' end end
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/alex.osheter/listtest/doc
(
edit
)