diff --git a/res/modules/data_buffer.lua b/res/modules/data_buffer.lua index 002c8ea1..aafe63e7 100644 --- a/res/modules/data_buffer.lua +++ b/res/modules/data_buffer.lua @@ -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