Initialize all ringbuffer keys explicitly

Use false instead of nil.
This commit is contained in:
Jürgen Rühle 2024-10-10 20:22:49 +02:00 committed by ryvnf
parent 70a0070184
commit 4e30ee9657

View File

@ -15,6 +15,8 @@ function ringbuffer.new(size, initial_values)
return setmetatable({
data = values,
size = size,
auto_update_node_meta_key = false,
node_meta_private = false,
}, ringbuffer_class)
end
@ -67,7 +69,7 @@ function ringbuffer.get_from_node_meta(pos, key, size, private)
local meta = minetest.get_meta(pos)
rb = ringbuffer.deserialize(size, meta:get_string(key)) or ringbuffer.new(size)
rb.auto_update_node_meta_key = node_meta_key
rb.node_meta_private = private
rb.node_meta_private = private or false
node_meta_rb_cache[node_meta_key] = rb
end
return rb