Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Gadget850/Echo
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 str = {} --------------------------------------------------- -- Function: echo -- -- This function returns the contents of the target string. -- -- Usage: -- {{#invoke:Echo|echo|target_string|}} -- OR -- {{#invoke:Echo|echo|s=target_string}} -- -- Parameters -- s: The string whose contents to display -- -- If invoked using named parameters, Mediawiki will automatically -- remove any leading/trailing whitespace from the target string. function str.echo( frame ) local new_args = str._getParameters( frame.args, {'s'} ); local s = new_args['s'] or ''; return s end --------------------------------------------------- -- Function: table -- -- This function returns a test table in wikimarkup. function str.table( frame ) local str = [[{| class="wikitable" |- ! Header text !! Header text !! Header text |- | Example || Example || Example |- | Example || Example || Example |- | Example || Example || Example |}]] end ----------------------------------------- -- Helper function that populates the argument list given that user -- may need to use a mix of named and unnamed parameters. This is -- relevant because named parameters are not identical to unnamed -- parameters due to string trimming, and when dealing with strings, -- there can be a need to either preserve or remove that whitespace -- depending on the application. function str._getParameters( frame_args, arg_list ) local new_args = {}; local index = 1; local value; for i,arg in ipairs( arg_list ) do value = frame_args[arg] if value == nil then value = frame_args[index]; index = index + 1; end new_args[arg] = value; end return new_args; end return str
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/Gadget850/Echo/doc
(
edit
)