GE Lua Documentation

Press F to search!

addButton

Definition


-- @/lua/ge/extensions/ui/vehicleSelector/vehicleOperations.lua:434

-- Expose button instance methods for external use
M.addButton = function(...) return buttonInstance.addButton(...) end

Callers

@/lua/ge/extensions/flowgraph/nodes/ui/buttons/simpleMultipleButtons.lua
  for i = 1, self.count do
    self.pinOut['buttonId_' ..i].value = self.mgr.modules.button:addButton({
      label = self.pinIn['label_' ..i].value,
@/lua/ge/extensions/ui/vehicleSelector/vehicleOperations.lua
    if configDetails.Source == "Custom" then
      table.insert(buttons, buttonInstance.addButton(nop, {
        label = "Edit Metadata",

    table.insert(buttons, buttonInstance.addButton(function(...)
      guihooks.trigger("ChangeState","play")

    table.insert(buttons, buttonInstance.addButton(function(...)
      guihooks.trigger("ChangeState","play")
      -- Set as default button
      table.insert(buttons, buttonInstance.addButton(function()
        extensions.core_vehicle_partmgmt.savedefault()
      -- Load default button
      table.insert(buttons, buttonInstance.addButton(function()
        callbackAfterFade = function()

    table.insert(buttons, buttonInstance.addButton(function()
      guihooks.trigger("ChangeState","vehicle-config/save")
    -- Clone current button
    table.insert(buttons, buttonInstance.addButton(function()
      guihooks.trigger("ChangeState","play")
    -- Select Random
    table.insert(buttons, buttonInstance.addButton(function()
      extensions.hook("onVehicleSelectorSelectRandom")
    -- Reset all button
    table.insert(buttons, buttonInstance.addButton(function()
      resetGameplay(-1)
    -- Remove all button
    table.insert(buttons, buttonInstance.addButton(function()
      core_vehicles.removeAll();
    -- Remove current button
    table.insert(buttons, buttonInstance.addButton(function()
      core_vehicles.removeCurrent();
    -- Remove others button
    table.insert(buttons, buttonInstance.addButton(function()
      core_vehicles.removeAllExceptCurrent();
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/levelTiles.lua
    table.insert(data.buttonInfo,
      buttonInstance.addButton(function()
        -- Track recent usage
    table.insert(data.buttonInfo,
      buttonInstance.addButton(function()
        -- open freeroam configurator with current level and spawn point
      for _, button in ipairs(customButtons) do
        table.insert(data.buttonInfo, buttonInstance.addButton(function()
          button.callback(itemDetails.levelName, itemDetails.spawnPointObjectName, itemDetails.key)
@/lua/ge/extensions/freeroam/freeroamConfigurator.lua

  buttonModule.addButton(M.startFreeroam, {
    label = "Start Freeroam",
@/lua/ge/extensions/ui/gridSelectorUtils/buttonModule.lua
  -- Add a button with callback function
  local function addButton(callback, meta)
    local buttonId = getFreeButtonId()
@/lua/ge/extensions/ui/vehicleSelector/detailsInteraction.lua
    for _, button in ipairs(M.customDetailsButtons) do
      table.insert(buttonInfo, ui_vehicleSelector_vehicleOperations.addButton(function(additionalData)
        if not additionalData then
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenBegin.lua

    table.insert(defaultBtns, self.mgr.modules.ui:addButton(
      function()
    if self.pinIn.contStartActive.value then
      table.insert(defaultBtns, self.mgr.modules.ui:addButton(
          function()
  else
    table.insert(defaultBtns, self.mgr.modules.ui:addButton(
        function()
    if self.pinIn.contHereActive.value then
      table.insert(defaultBtns, self.mgr.modules.ui:addButton(
          function()
    defaultBtns = {
      self.mgr.modules.ui:addButton(
        function()
    if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
      table.insert(defaultBtns, self.mgr.modules.ui:addButton(
        function()
      if mission then
        table.insert(defaultBtns, self.mgr.modules.ui:addButton(
          function()
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/createButton.lua
function C:workOnce()
  self.pinOut.buttonId.value = self.mgr.modules.button:addButton({
  label = self.pinIn.label.value,
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenWhole.lua
      if mission then
        table.insert(defaultBtns, self.mgr.modules.ui:addButton(
          function()

    table.insert(defaultBtns, self.mgr.modules.ui:addButton(
      function()
  if not self.mgr.startedAsScenario then
    table.insert(defaultBtns, self.mgr.modules.ui:addButton(
        function()
  else
    table.insert(defaultBtns, self.mgr.modules.ui:addButton(
        function()
  if canContinueHere then
    table.insert(defaultBtns, self.mgr.modules.ui:addButton(
        function()
    defaultBtns = {
      self.mgr.modules.ui:addButton(
        function()
    if self.pinIn[btn..'_active'].value and self.pinIn[btn].value and self.pinIn[btn].value ~= "" then
      table.insert(defaultBtns, self.mgr.modules.ui:addButton(
        function()
@/lua/ge/extensions/flowgraph/modules/buttonModule.lua
-- adds a new Button.
function C:addButton(data)
  local id = self:getFreeId()
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/campaignTiles.lua
    buttonInfo = {
      buttonInstance.addButton(function()
        -- Track recent usage
@/lua/ge/extensions/ui/appSelector/general.lua
  -- Add "Add to layout" button
  local addToLayoutButton = buttonInstance.addButton(function(additionalData)
    guihooks.trigger('appContainer:spawn', { appName = app.appName })
@/lua/ge/extensions/flowgraph/nodes/gameplay/recoveryPrompt/setRecoveryPromptButton.lua

  core_recoveryPrompt.addButton(self.pinIn.buttonId.value, self.pinIn.label.value, nop, self.pinIn.order.value, nil, true, true, self.pinIn.fadeActive.value, self.pinIn.icon.value)
end
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/scenarioTiles.lua
    buttonInfo = {
      buttonInstance.addButton(function()
        -- Track recent usage
@/lua/ge/extensions/ui/gameplaySelector/tileGenerators/missionTiles.lua
    table.insert(data.buttonInfo,
      buttonInstance.addButton(function()
        -- Track recent usage
@/lua/ge/extensions/flowgraph/nodes/ui/buttons/simpleButton.lua
  -- create new button.
    self.pinOut.buttonId.value = self.mgr.modules.button:addButton({
    label = self.pinIn.label.value,
@/lua/ge/extensions/flowgraph/modules/uiModule.lua
  if self.uiLayout.mode == 'startScreen' then
    table.insert(self.uiLayout.buttons, self:addButton(function()
      self.mgr.graphs[self.uiLayout._node.graphId].nodes[self.uiLayout._node.nodeId]:startFromUi()
    if mission and mission:hasRules() then
      table.insert(self.uiLayout.buttons, self:addButton(function()
        mission:showRulesAsPopups()

function C:addButton(fun, meta)
  if not self.isBuilding then
@/lua/ge/extensions/core/recoveryPrompt.lua

local function addButton(id, label, atFadeFunction, order, message, active, enabled, fadeActive, icon)
  if not id then log("E","","Tried creating button without ID!" ) return end