m
→Code: Still inefficient, but not as bad.
mNo edit summary |
m (→Code: Still inefficient, but not as bad.) |
||
| Line 42: | Line 42: | ||
function {{PAGENAME}}(order, ...) | function {{PAGENAME}}(order, ...) | ||
local output = {} | local output = {} | ||
order = tostring(order) | order = tostring(order) | ||
for i=1, strlen(order) do | for i=1, strlen(order) do | ||
local | local value = select(tonumber(strsub(order, i, i), ...) | ||
if | if value ~= nil then | ||
table.insert(output, | table.insert(output, value) | ||
end | end | ||
end | end | ||
return unpack(output) | return unpack(output) | ||
end | end | ||
Variant | Variant | ||
local {{PAGENAME}}_Out | |||
local {{PAGENAME}}_Out | |||
function {{PAGENAME}}(order, ...) | function {{PAGENAME}}(order, ...) | ||
{{PAGENAME}}_Out = {} | {{PAGENAME}}_Out = {} | ||
order = tostring(order) | order = tostring(order) | ||
for i=1, strlen(order) do | for i=1, strlen(order) do | ||
local | local value = select(tonumber(strsub(order, i, i)), ...) | ||
if | if value ~= nil then | ||
table.insert({{PAGENAME}}_Out, | table.insert({{PAGENAME}}_Out, value) | ||
end | end | ||
end | end | ||
return unpack({{PAGENAME}}_Out) | return unpack({{PAGENAME}}_Out) | ||
end | end | ||
__NOTOC__ | __NOTOC__ | ||
[[Category:User Defined Functions]] | [[Category:User Defined Functions]] | ||