Nie podano opisu zmian |
Nie podano opisu zmian |
||
Linia 6: | Linia 6: | ||
local indexed_table = {} |
local indexed_table = {} |
||
for k, v in pairs(t) do |
for k, v in pairs(t) do |
||
− | + | indexed_table:insert(v) |
|
end |
end |
||
return unpack(indexed_table) |
return unpack(indexed_table) |
Wersja z 16:48, 8 sie 2018
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Utils/opis
local module_export = {}
function module_export.unpack_any_table(t)
t = t or {} -- nil will throw
local indexed_table = {}
for k, v in pairs(t) do
indexed_table:insert(v)
end
return unpack(indexed_table)
end
function module_export.sum(...)
local sum = 0;
for i = 1, arg.n do
sum = sum + arg[i]
end
return sum
end
function module_export.to_percent(value)
return value * 100 .. "%"
end
return module_export