Loading

Paste #ply0neh6l

  1.    -- Add choice buttons
  2.   local choices = self.message.choices
  3.   self.choice_buttons = {}
  4.   local orig_y = 175
  5.   if choices then
  6.     for i = 1, #choices do
  7.       local y = orig_y + ((i-1) + (3-#choices)) * 48
  8.       local choice = choices[i].choice
  9.       local additionalInfo = choices[i].additionalInfo
  10.       -- NB: both nil and true result in enabled; also handle old "disabled" choice
  11.       local enabled = (choices[i].enabled ~= false) and (choice ~= "disabled")
  12.       local --[[persistable:fax_choice_button]] function callback()
  13.         self:choice(choice,additionalInfo)
  14.       end
  15.       self.choice_buttons[i] = self:addPanel(17, 492, y):makeButton(0, 0, 43, 43, 18, callback)
  16.         :setDisabledSprite(19):enable(enabled)
  17.     end
  18.   end

Comments