Check length of serialized item stacks
This commit is contained in:
parent
e99b25ac75
commit
5901137c1e
7
api.lua
7
api.lua
|
@ -336,7 +336,12 @@ meshnode.create = function(pos, parent)
|
|||
if meta_tab.inventory then
|
||||
for _, list in pairs(meta_tab.inventory) do
|
||||
for i, stack in ipairs(list) do
|
||||
list[i] = ItemStack(stack):to_string()
|
||||
local str = ItemStack(stack):to_string()
|
||||
if str:len() > 0xffff then
|
||||
minetest.log("error", "String too long for serialization!")
|
||||
str = ""
|
||||
end
|
||||
list[i] = str
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
6
init.lua
6
init.lua
|
@ -275,12 +275,6 @@ minetest.register_entity("meshnode:ctrl", {
|
|||
end
|
||||
end,
|
||||
get_staticdata = function(self)
|
||||
for k, v in pairs(self.nodes) do
|
||||
if type(v) == "string" and v:len() > 0xffff then
|
||||
minetest.log("error", "String too long for serialization!")
|
||||
self.nodes[k] = ""
|
||||
end
|
||||
end
|
||||
local data = {self.mesh_id, self.activated, self.nodes}
|
||||
return minetest.serialize(data)
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue