A quick example
Code: Select all
array = require 'array'
-- create an array object from a set of items
a = array.from(0,2,4,6,8) -- a: {0,2,4,6,8}
-- create an array object using a function
b = array.new(function(index) return index*2 - 1 end, 5) -- b: {1,3,5,7,9}
-- tables created by the module support OOP
c = a:fusion(function(a, b) return a < b end, b) -- c: {1,2,3,4,...,8,9}
-- but you can work with pure tables as well
array.print({'Hi','Hello','Bye'}) -- output: [Hi, Hello, Bye]
On the GitHub repository you will find a complete documentation with examples for each function. I hope you'll enjoy
https://github.com/rick4stley/array