init commit
This commit is contained in:
21
tests/luau/map_filter.luau
Normal file
21
tests/luau/map_filter.luau
Normal file
@ -0,0 +1,21 @@
|
||||
--!strict
|
||||
|
||||
local Array = require("../../luau/src")
|
||||
|
||||
local numbers = Array.new()
|
||||
for i = 1, 100 do
|
||||
numbers:push(i)
|
||||
end
|
||||
print(numbers:debug_display(), "\nlength=", numbers:len())
|
||||
|
||||
local start = os.clock()
|
||||
|
||||
numbers:map(function(n: number)
|
||||
return tostring(n)
|
||||
end):foreach(function(e) print("(:map)squared=", e) end)
|
||||
|
||||
numbers:filter(function(n: number)
|
||||
return bit32.band(n, 1) ~= 0
|
||||
end):foreach(function(e) print("(:filter)odd=", e) end)
|
||||
|
||||
print(os.clock()-start)
|
Reference in New Issue
Block a user