Merge pull request #191 from Onran0/main

data_buffer: constructor fix
This commit is contained in:
MihailRis 2024-03-18 17:58:24 +03:00 committed by GitHub
commit c0364d4e5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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)
return obj
end
-- Push functions