模块:沙盒/Lt2818/test

来自Local Chinese Wikipedia
imported>Lt28182022年9月6日 (二) 05:01的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到导航 跳转到搜索

此模块的文档可以在Module:沙盒/Lt2818/test/doc创建

local p = {}
 
function p.hello(s)
	if not getArgs then
		getArgs = require('Module:Arguments').getArgs
	end
	local tmp = getArgs(s)
    return "− " .. tmp.m
end

function p.cannotoutputminussign()
    return 0-2 --製造出一個負數,你無法讓他輸出成−
end

function p.MinusSignReplace(str)
	local input_str = str
	if type(str) == type({"table"}) then
		input_str = (str.args or {})[1] or str[1] or ''
	elseif type(str) ~= type("string") then
		input_str = tostring(str)
	end
	local body = mw.ustring.gsub(input_str,'%-','−')
	return body
end

return p