28 lines
515 B
Lua
28 lines
515 B
Lua
|
local util = require("util")
|
||
|
local nibbleArray = require("nibbleArray")
|
||
|
|
||
|
local MAX_HEIGHT = 128
|
||
|
|
||
|
local chunk = {}
|
||
|
|
||
|
local defaultsTable = {
|
||
|
blocks = {}
|
||
|
}
|
||
|
|
||
|
function chunk:new()
|
||
|
local newTable = util.deepCopyTable(defaultsTable) or {}
|
||
|
|
||
|
local blockBufferSize = 16 * 16 * MAX_HEIGHT
|
||
|
for i = 1, blockBufferSize do
|
||
|
table.insert(newTable.blocks, 0)
|
||
|
end
|
||
|
print(#newTable.blocks)
|
||
|
|
||
|
-- Set this table as this """class"""'s metatable
|
||
|
setmetatable(newTable, self)
|
||
|
self.__index = self
|
||
|
|
||
|
return newTable
|
||
|
end
|
||
|
|
||
|
return chunk
|