You can't use for loop in the table definition. You have to close table definition first and then add items to that table.
Lua Code:
optionsTable:insert({ --[17] --> Blacksmithing Rules submenu <--
type = "submenu",
name = getTranslated("CRAFTING_TYPE_BLACKSMITHING"),
controls = setmetatable({}, { __index = table })
})
--get reference to the controls table of the last added item (submenu)
local submenuControls = optionsTable[#optionsTable].controls
submenuControls:insert({--[17.1]
type = "dropdown",
name = getTranslated("setAllOptions") .."|r",
tooltip = getTranslated("setAllOptionsTooltip"),
choices = getTranslateTable(sendingType),
getFunc = function() return "-" end,
setFunc = function(value) setAllOptions(value,numProfile,blackSmithingRules) end,
})
for _, craftKey in pairs(blackSmithingRules) do --<-- LINE 351
submenuControls:insert({
type = "dropdown",
name = getTranslated(craftKey),
choices = getTranslateTable(sendingType),
getFunc = function() return getTranslated(BankManager.Saved[craftKey][numProfile]) end,
setFunc = function(val) changeTranslateTable(val, craftKey, numProfile) end,
})
end