From c3027368b6d8619224122d4ab2fd29f9bf4b535a Mon Sep 17 00:00:00 2001 From: Onran <100285264+Onran0@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:24:29 +0900 Subject: [PATCH 1/2] data_buffer: constructor fix --- res/modules/data_buffer.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/res/modules/data_buffer.lua b/res/modules/data_buffer.lua index 002c8ea1..9db06e9c 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) + print("asg") + return obj end -- Push functions From 7756649db89a7098099ac8826293eb220a92fd9c Mon Sep 17 00:00:00 2001 From: Onran <100285264+Onran0@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:29:48 +0900 Subject: [PATCH 2/2] data_buffer: debug code removed --- res/modules/data_buffer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/modules/data_buffer.lua b/res/modules/data_buffer.lua index 9db06e9c..aafe63e7 100644 --- a/res/modules/data_buffer.lua +++ b/res/modules/data_buffer.lua @@ -38,7 +38,7 @@ function data_buffer:new(bytes) self.__index = self setmetatable(obj, self) - print("asg") + return obj end