scp-fs2open/fs2open.github.com

Missing `.Action` while setting up a LuaSEXP yields a CTD

Closed this issue · 0 comments

This script caused a CTD during game start. It wasn't immediately clear that I'd forgotten .Action in the assignments.

#Conditional Hooks

$Application: FS2_Open

$On Game Init: [
  (function()

  local function transform(text)
    local message = mn.Messages[text]
    if message and message:isValid() then
      text = message.Message
    end
    text = ba.replaceTokens(text)
    text = ba.replaceVariables(text)
    return text
  end

  mn.LuaSEXPs['set-directive-text'] = function(event, text)
    event.DirectiveText = transform(text)
  end

  mn.LuaSEXPs['set-directive-keypress-text'] = function(event, text)
    event.DirectiveKeypressText = transform(text)
  end

  end)()
]

#End