GE Lua Documentation

Press F to search!

loadEditorExtension

Definition


-- @/lua/ge/extensions/editor/main.lua:140

local function loadEditorExtension(name)
  extensions.load(name)
  if extensions.isExtensionLoaded(name) then
    table.insert(M.extensionNames, name)
    if extensions[name].onEditorRegisterPreferences then
      extensions[name].onEditorRegisterPreferences(editor.preferencesRegistry)
      -- save the current prefs
      editor.savePreferences()
      -- reload them again to have the new loaded extension access them too
      editor.loadPreferences()
      editor.updatePreferencePages()
    end
    if extensions[name].onEditorRegisterApi then
      extensions[name].onEditorRegisterApi()
    end
    if extensions[name].onEditorInitialized then
      extensions[name].onEditorInitialized()
    end
    if extensions[name].onEditorActivated then
      extensions[name].onEditorActivated()
    end
    if not editor.preferencesRegistry.dontCallHookForSetValue then
      -- set value to trigger new extension to update its pref related data
      editor.preferencesRegistry:callHookForSetValue()
    end
    return rawget(extensions, name)
  end

  return nil
end

Callers