mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-05 08:10:05 +00:00
28 lines
481 B
Plaintext
28 lines
481 B
Plaintext
class Vector
|
|
function __init(self)
|
|
self.vector = {}
|
|
self.x = 0
|
|
end
|
|
|
|
function push(self, val)
|
|
self.vector[self.x++] = val
|
|
end
|
|
|
|
function pop(self)
|
|
return self.vector[--self.x]
|
|
end
|
|
|
|
function __index(self, key)
|
|
return self.vector[key]
|
|
end
|
|
end
|
|
|
|
var vector = Vector()
|
|
|
|
for (var i = 0; i < 100000; i++) do
|
|
vector.push(i)
|
|
end
|
|
|
|
for (var i = 0; i < 100000; i++) do
|
|
print(vector.pop() .. " : " .. vector[i])
|
|
end |