Add ringbuffer.deserialize

This commit is contained in:
Jürgen Rühle 2024-10-10 13:08:49 +02:00 committed by ryvnf
parent 871cfd3a77
commit 5d8f0b606e

View File

@ -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)