Originally Posted by Garkin
Modified code if you use metatable as it is in HarvestMaps addon (again, I assume that you use "optionsTable"):
Lua Code:
for _, craftKey in pairs(blackSmithingRules) do optionsTable: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
|
I used HarvestMap as template yes, and my table is called "optionsTable".
This part works fine with no issues:
Lua Code:
optionsTable:insert({ --[16] --> Stacks Rules submenu <--
type = "submenu",
name = getTranslated("subMenuStacksRules"),
tooltip = getTranslated("subMenuStacksRulesTooltip"),
controls = {
{--[16.1]
type = "dropdown",
name = getTranslated("fillStacks"),
tooltip = getTranslated("fillStacksTooltip"),
choices = getTranslateTable(sendingType),
getFunc = function() return getTranslated(BankManager.Saved["fillStacks"][numProfile]) end,
setFunc = function(value) changeTranslateTable(value,"fillStacks",numProfile) end,
},
{--[16.2]
type = "checkbox",
name = getTranslated("stackSizeCheckBox"),
tooltip = getTranslated("stackSizeCheckBoxTooltip"),
getFunc = function() return BankManager.Saved["stackSizeCheckBox"][numProfile] end,
setFunc = function(value) BankManager.Saved["stackSizeCheckBox"][numProfile] = value end,
},
{--[16.3]
type = "slider",
name = getTranslated("stackSizeSlider"),
tooltip = getTranslated("stackSizeSliderTooltip"),
min = 1,
max = 100,
step = 1,
getFunc = function() return BankManager.Saved["stackSizeSlider"][numProfile] end,
setFunc = function(value) BankManager.Saved["stackSizeSlider"][numProfile] = value end,
},
},
})
This one fails:
Lua Code:
optionsTable:insert({ --[17] --> Blacksmithing Rules submenu <--
type = "submenu",
name = getTranslated("CRAFTING_TYPE_BLACKSMITHING"),
controls = {
{--[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
optionsTable: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
},
})
with this error:
Code:
user:/AddOns/BankManagerRevived/UI/BankManagerOpts.lua:351: unexpected symbol near 'for'
Line 351 is line 13 in this cutout. I just don't get it