View Single Post
11/19/14, 03:16 PM   #15
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
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:
  1. optionsTable:insert({ --[17] --> Blacksmithing Rules submenu <--
  2.     type = "submenu",
  3.     name = getTranslated("CRAFTING_TYPE_BLACKSMITHING"),
  4.     controls = setmetatable({}, { __index = table })
  5. })
  6.  
  7. --get reference to the controls table of the last added item (submenu)
  8. local submenuControls = optionsTable[#optionsTable].controls
  9.  
  10. submenuControls:insert({--[17.1]
  11.     type = "dropdown",
  12.     name = getTranslated("setAllOptions") .."|r",
  13.     tooltip = getTranslated("setAllOptionsTooltip"),
  14.     choices = getTranslateTable(sendingType),
  15.     getFunc = function() return "-" end,
  16.     setFunc = function(value) setAllOptions(value,numProfile,blackSmithingRules) end,
  17. })
  18.  
  19. for _, craftKey in pairs(blackSmithingRules) do  --<-- LINE 351
  20.     submenuControls:insert({
  21.         type = "dropdown",
  22.         name = getTranslated(craftKey),
  23.         choices = getTranslateTable(sendingType),
  24.         getFunc = function() return getTranslated(BankManager.Saved[craftKey][numProfile]) end,
  25.         setFunc = function(val) changeTranslateTable(val, craftKey, numProfile) end,
  26.     })
  27. end
  Reply With Quote