data_buffer: constructor fix

This commit is contained in:
Onran
2024-03-18 23:24:29 +09:00
committed by GitHub
parent 541fce0751
commit c3027368b6
+17 -3
View File
@@ -22,10 +22,24 @@ local TYPE_DOUBLE = 6
-- Data buffer
local data_buffer = { }
local data_buffer =
{
__call =
function(data_buffer, bytes)
return data_buffer:new(bytes)
end
}
function data_buffer.__call(bytes)
return setmetatable({ pos = 1, bytes = bytes or { } }, { __index = data_buffer })
function data_buffer:new(bytes)
local obj = {
pos = 1,
bytes = bytes or { }
}
self.__index = self
setmetatable(obj, self)
print("asg")
return obj
end
-- Push functions