Module:Sandbox/Colin R Robinson: Difference between revisions
Appearance
imported>Colin R Robinson No edit summary |
imported>Colin R Robinson No edit summary |
||
Line 2: | Line 2: | ||
local p = {} | local p = {} | ||
-- Function that takes a | -- Function that takes a table containing "saying" as a key and appends an exclamation mark to its value | ||
function p.addExclamation(saying | function p.addExclamation(frame) | ||
-- Extract the saying from the frame.args table | |||
local saying = frame.args[1] or frame.args.saying | |||
-- Check if saying is not nil or empty | -- Check if saying is not nil or empty | ||
if saying ~= nil and saying ~= '' then | if saying ~= nil and saying ~= '' then |
Latest revision as of 06:07, 26 March 2024
Documentation for this module may be created at Module:Sandbox/Colin R Robinson/doc
-- Define the module table
local p = {}
-- Function that takes a table containing "saying" as a key and appends an exclamation mark to its value
function p.addExclamation(frame)
-- Extract the saying from the frame.args table
local saying = frame.args[1] or frame.args.saying
-- Check if saying is not nil or empty
if saying ~= nil and saying ~= '' then
return saying .. "!"
else
return "Empty input!"
end
end
-- Return the module table
return p