Modul:Sort: Unterschied zwischen den Versionen
2019-10-29
(2019-10-27) |
(2019-10-29) |
||
| Zeile 1: | Zeile 1: | ||
local Sort = { suite = "Sort", | local Sort = { suite = "Sort", | ||
serial = "2019-10- | serial = "2019-10-29", | ||
item = 24205172 } | item = 24205172 } | ||
--[=[ | --[=[ | ||
| Zeile 20: | Zeile 20: | ||
-- Postcondition: | -- Postcondition: | ||
-- Returns whatever, probably table | -- Returns whatever, probably table | ||
-- 2019-10- | -- 2019-10-29 | ||
local storage = access | local storage = access | ||
local fun, lucky, r | local finer = function () | ||
if append then | |||
storage = string.format( "%s/%s", | |||
storage, | |||
append ) | |||
end | |||
end | |||
local fun, lucky, r, suited | |||
if advanced then | if advanced then | ||
fun = require | fun = require | ||
| Zeile 28: | Zeile 35: | ||
fun = mw.loadData | fun = mw.loadData | ||
end | end | ||
if | GlobalMod.globalModules = GlobalMod.globalModules or { } | ||
suited = GlobalMod.globalModules[ access ] | |||
if not suited then | |||
finer() | |||
lucky, r = pcall( fun, "Module:" .. storage ) | |||
end | end | ||
if not lucky then | if not lucky then | ||
if not suited and | if not suited and | ||
type( alt ) == "number" and | type( alt ) == "number" and | ||
| Zeile 45: | Zeile 51: | ||
if type( suited ) == "string" then | if type( suited ) == "string" then | ||
storage = suited | storage = suited | ||
finer() | |||
lucky, r = pcall( fun, storage ) | lucky, r = pcall( fun, storage ) | ||
end | end | ||
| Zeile 69: | Zeile 73: | ||
local r = adjust | local r = adjust | ||
if adapt or not r:match( "^[ -~]*$" ) then | if adapt or not r:match( "^[ -~]*$" ) then | ||
local collate, post, pre | local collate, post, pre | ||
if apply then | if apply then | ||
| Zeile 104: | Zeile 107: | ||
collate = tmp | collate = tmp | ||
for i = 1, n do | for i = 1, n do | ||
tmp = foreignModule( Sort.suite, | |||
false, | |||
variants[ i ], | |||
Sort.item ) | |||
if type( tmp ) == "table" then | if type( tmp ) == "table" then | ||
var = tmp.single | var = tmp.single | ||
| Zeile 135: | Zeile 140: | ||
end -- for k, v | end -- for k, v | ||
end | end | ||
elseif | elseif type( tmp ) == "string" then | ||
collate = | collate = tmp | ||
break -- for i | break -- for i | ||
else | else | ||
collate = | collate = "Invalid table " .. variants[ i ] | ||
break -- for i | break -- for i | ||
end | end | ||
| Zeile 160: | Zeile 165: | ||
s = " " | s = " " | ||
end | end | ||
elseif (k >= | elseif ( k >= 0x0300 and k <= 0x0362 ) or | ||
(k >= | ( k >= 0x1AB0 and k <= 0x1AFF ) or | ||
(k >= | ( k >= 0x1DC0 and k <= 0x1DFF ) or | ||
(k >= | ( k >= 0xFE20 and k <= 0xFE2F ) then | ||
-- COMBINING ... | -- COMBINING ... | ||
s = "" | s = "" | ||