Toggle menu
15
236
70
27.5K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Params/testcases/mdummy: Difference between revisions

From Kenshi Wiki
Prd changed the content model of the page Module:Params/testcases/mdummy from "wikitext" to "Scribunto module"
No edit summary
 
Line 1: Line 1:
local iface = {}


iface.echo_sb = function(frame)
local args = frame.args
local ret = ''
newtab = {}
for key, val in pairs(args) do newtab[key] = val end
for key,val in ipairs(newtab) do
ret = ret .. '[' .. key .. '=' .. val .. ']'
newtab[key] = nil
end
for key,val in pairs(newtab) do
ret = ret .. '[' .. key .. '=' .. val .. ']'
end
return ret
end
return iface

Latest revision as of 04:58, 9 March 2025

This submodule is designed to be used as a dummy callback by templates that want to test Module:Params.

Usage

{{#invoke:Params/testcases/mdummy|function_name}}

Functions

Here follows the list of functions.

echo_sb

The echo_sb function simply echoes all the parameters it was called with, surrounding these within square brackets. It is virtually identical to the {{Module:Params/testcases/tdummy echo sb}} template.

Examples:

  • {{#invoke:params/testcases/mdummy|echo_sb|foo|bar|Jupiter|hello=world}}
    ↳ [1=foo][2=bar][3=Jupiter][hello=world]

local iface = {}

iface.echo_sb = function(frame)
	local args = frame.args
	local ret = ''
	newtab = {}
	for key, val in pairs(args) do newtab[key] = val end
	for key,val in ipairs(newtab) do
		ret = ret .. '[' .. key .. '=' .. val .. ']'
		newtab[key] = nil
	end
	for key,val in pairs(newtab) do
		ret = ret .. '[' .. key .. '=' .. val .. ']'
	end
	return ret
end

return iface