Encode group permissions as a 1-based array (#472)

encode_group_permissions filled the whitelist and blacklist starting at
index 0. Factorio's table_to_json only serialises a table as a JSON array
when its keys run 1..n, so the permissions reached the instance plugin as
an object and every GroupUpdateRequest failed schema validation.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Bastiaan
2026-09-09 15:47:01 +01:00
committed by GitHub
co-authored by Claude Fable 5.1
parent 0854a2b7d5
commit 24efb82d0f
+2 -2
View File
@@ -102,11 +102,11 @@ local function encode_group_permissions(group)
local allows_action = group.allows_action
for input_action_name, input_action in pairs(defines.input_action) do
if allows_action(input_action) then
whitelist[whitelist_index] = input_action_name
whitelist_index = whitelist_index + 1
whitelist[whitelist_index] = input_action_name
else
blacklist[blacklist_index] = input_action_name
blacklist_index = blacklist_index + 1
blacklist[blacklist_index] = input_action_name
end
end