From 5d8f0b606e3de938938c65f758137bd57aea6cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20R=C3=BChle?= Date: Thu, 10 Oct 2024 13:08:49 +0200 Subject: [PATCH] Add ringbuffer.deserialize --- mods/CORE/mcl_util/ringbuffer.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/CORE/mcl_util/ringbuffer.lua b/mods/CORE/mcl_util/ringbuffer.lua index 34586cb0f..a39803f3d 100644 --- a/mods/CORE/mcl_util/ringbuffer.lua +++ b/mods/CORE/mcl_util/ringbuffer.lua @@ -42,4 +42,9 @@ function ringbuffer_class:serialize() return minetest.serialize(self.data) end +function ringbuffer.deserialize(size, serialized_data) + local rb_data = minetest.deserialize(serialized_data) + return rb_data and ringbuffer.new(size, rb_data) +end + return setmetatable(ringbuffer, ringbuffer_class)