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.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision |
Your text |
| Line 140: |
Line 140: |
| :gsub('-{', '-{'):gsub('}-', '}-')) | | :gsub('-{', '-{'):gsub('}-', '}-')) |
| -- the "extra" parentheses are important for removing the second value returned from `gsub` | | -- the "extra" parentheses are important for removing the second value returned from `gsub` |
| end
| |
|
| |
| --- Unstrip <nowiki> tags from first argument.
| |
| -- @author TheWWRNerdGuy
| |
| function lib.unstripNoWikiFrame(frame)
| |
| return mw.text.unstripNoWiki(frame.args[1])
| |
| end | | end |
|
| |
|
| Line 334: |
Line 328: |
| end | | end |
| return false | | return false |
| end
| |
|
| |
| -- nullable number
| |
| function lib.toNullableNumber(str)
| |
| if str == nil then
| |
| return nil
| |
| end
| |
| return tonumber(str)
| |
| end
| |
|
| |
| -- array slice
| |
| function lib.arraySlice(tbl, first, last)
| |
| if first ~= nil and first < 0 then
| |
| first = #tbl + 1 + first
| |
| end
| |
| if last ~= nil and last < 0 then
| |
| last = #tbl + last
| |
| end
| |
|
| |
| local sliced = {}
| |
|
| |
| for i = first or 1, last or #tbl, 1 do
| |
| sliced[#sliced+1] = tbl[i]
| |
| end
| |
|
| |
| return sliced
| |
| end
| |
|
| |
| --sanitize file name
| |
| --removes invalid characters for file name
| |
| function lib.sanitizeFileName(str)
| |
| str = string.gsub(str, "[:*?\"<>|]", "")
| |
| str = string.gsub(str, "[/\\]", " ")
| |
| return str
| |
| end | | end |
|
| |
|
| return lib | | return lib |