2,875
edits
(Created page with "local p = {} local Debug = require('module:Debug') local FL = require('module:FunList') function p.test() local tbl = { { name = "Alice", age = 30, gender = "female" }, { name = "Bob", age = 25, gender = "male" }, { name = "Charlie", age = 35, gender = "male" }, { name = "David", age = 28, gender = "male" }, { name = "Eve", age = 32, gender = "female" }, { name = "Frank", age = 27, gender = "male" }, { name = "Grace", age = 31, gender = "fe...") |
No edit summary |
||
Line 2: | Line 2: | ||
local Debug = require('module:Debug') | local Debug = require('module:Debug') | ||
local FL = require('module:FunList') | local FL = require('module:FunList/Enumerators') | ||
function p.test() | function p.test() | ||
local tbl = { | local tbl = {} | ||
for i = 1, 10 do | |||
tbl[i] = string.char(string.byte('a') + i - 1) -- Calculate the character | |||
end | |||
tbl['TextOK'] = 999 | |||
local enum = FL.TableEnumerator.new(tbl) | |||
local enum2 = FL.TableEnumerator.new({1,2,3,4,5,6}) | |||
local concatEnum = FL.ConcatEnumerator.new(enum, enum2) | |||
local selectEnum = FL.SelectEnumerator.new(concatEnum, function(x) return x .. x end) | |||
for k, v in ipairs(selectEnum) do | |||
Debug.log(v) | |||
end | |||
--Debug.log(enum) | |||
Debug.log( | |||
end | end | ||
return p | return p |
edits