Module:Addcommas: Difference between revisionsGive feedback
Created page with "-- -- @Attribution https://runescape.wiki/w/Module:Addcommas -- local libraryUtil = require('libraryUtil') local p = {} -- -- main function -- keep public so it can be used in other modules -- function p._add(arg, sep) libraryUtil.checkTypeMulti('Module:Addcommas._add', 1, arg, {'number', 'string'}) libraryUtil.checkType('"Module:Addcommas"._add', 2, sep, "string", true); local lang = mw.language.getContentLanguage() local x; if type(arg) == 'number'..." |
Undo revision 13730 by Sur (talk) helper functions should not be invoked directly. update access point |
||
| (One intermediate revision by one other user not shown) | |||
| Line 47: | Line 47: | ||
function p._strip(str) | function p._strip(str) | ||
libraryUtil.checkType('Module:Addcommas._strip', 1, str, 'string') | libraryUtil.checkType('Module:Addcommas._strip', 1, str, 'string') | ||
return str:gsub(',', '') | |||
end | end | ||
function p.commas(frame) | function p.commas(frame) | ||
local args = require("Module:Arguments").getArgs(frame); | --local args = require("Module:Arguments").getArgs(frame); -- Module:Arguments does not yet exist | ||
local str = frame.args[1] | |||
local delimiter = frame.args.sep | |||
return p._add(str, delimiter); | |||
end | end | ||
return p | return p | ||