mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Do not add empty array for recipe notifications
This commit is contained in:
1 file changed
+4
-1
@@ -426,10 +426,13 @@ function serialize.serialize_player(player)
|
|||||||
-- Serialize recipe notifications
|
-- Serialize recipe notifications
|
||||||
if recipe_notifications_api then
|
if recipe_notifications_api then
|
||||||
local recipe_notifications = {}
|
local recipe_notifications = {}
|
||||||
serialized.recipe_notifications = recipe_notifications
|
|
||||||
for i, recipe in ipairs(player.get_recipe_notifications()) do
|
for i, recipe in ipairs(player.get_recipe_notifications()) do
|
||||||
recipe_notifications[i] = recipe.name
|
recipe_notifications[i] = recipe.name
|
||||||
end
|
end
|
||||||
|
if #recipe_notifications > 0 then
|
||||||
|
-- Do no add if length is zero as this breaks with table_to_json
|
||||||
|
serialized.recipe_notifications = recipe_notifications
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return serialized
|
return serialized
|
||||||
|
|||||||
Reference in new issue
Block a user