# luadist/scite architecture

> Architecture diagram of the GitHub repository luadist/scite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luadist/scite
- Repository: https://github.com/luadist/scite
- Video tour (about a minute): https://gitdiagram.com/luadist/scite/video

## Overview

This tree is a partial source snapshot of SciTE, a Scintilla-based text editor, alongside an embedded Lua 5.1.4 runtime. The main user workflow is opening a file, editing it through Scintilla, and saving it; SciTE also exposes Lua extensions and background file work. The README documents GTK/Linux and Windows versions. The sampled source is limited, so links between unsampled editor subsystems are omitted; the Lua nodes reflect the runtime’s visible source layout rather than a fully traced call graph.

Main entry points: [`src/SciTEBase.h`](https://github.com/luadist/scite/blob/master/src/SciTEBase.h) (SciTE core), [`src/FileWorker.h`](https://github.com/luadist/scite/blob/master/src/FileWorker.h) (File I/O), [`lua/include/lua.h`](https://github.com/luadist/scite/blob/master/lua/include/lua.h) (Lua C API), [`lua/src/lstate.c`](https://github.com/luadist/scite/blob/master/lua/src/lstate.c) (Runtime state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor"]
  node_scite["SciTE core<br/>[SciTEBase.h]"]
  node_platform["Platform UI<br/>[SciTEWin.h]"]
  node_scintilla["Scintilla editor"]
end

subgraph group_files["File work"]
  node_file["File I/O<br/>[FileWorker.h]"]
  node_worker["Worker framework<br/>[Worker.h]"]
end

subgraph group_scripting["Lua integration"]
  node_luaextension["Lua extension<br/>[LuaExtension.h]"]
  node_luaapi["Lua C API<br/>[lua.h]"]
end

subgraph group_lua["Lua runtime"]
  node_lexer["Lexer<br/>[llex.c]"]
  node_parser["Parser<br/>[lparser.c]"]
  node_codegen["Code generation<br/>[lcode.c]"]
  node_vm["Virtual machine<br/>[lvm.c]"]
  node_state["Runtime state<br/>[lstate.c]"]
  node_stdlib["Standard libraries<br/>[linit.c]"]
  node_loadlib["Module loading<br/>[loadlib.c]"]
end

node_user(("Editor user"))
node_filesystem["Local files"]

node_user -->|"operates"| node_platform
node_platform -->|"handles UI"| node_scite
node_scite -->|"editor operations"| node_scintilla
node_scite -->|"loads and saves"| node_file
node_file -->|"reads and writes"| node_filesystem
node_file -->|"runs as"| node_worker
node_luaextension -.->|"uses API"| node_luaapi
node_luaapi -->|"operates on"| node_state
node_lexer -->|"provides tokens"| node_parser
node_parser -->|"emits instructions"| node_codegen
node_vm -->|"executes in"| node_state
node_stdlib -->|"registers libraries"| node_luaapi
node_loadlib -->|"loads modules"| node_state

click node_scite "https://github.com/luadist/scite/blob/master/src/SciTEBase.h"
click node_platform "https://github.com/luadist/scite/blob/master/win32/SciTEWin.h"
click node_file "https://github.com/luadist/scite/blob/master/src/FileWorker.h"
click node_worker "https://github.com/luadist/scite/blob/master/src/Worker.h"
click node_luaextension "https://github.com/luadist/scite/blob/master/src/LuaExtension.h"
click node_luaapi "https://github.com/luadist/scite/blob/master/lua/include/lua.h"
click node_lexer "https://github.com/luadist/scite/blob/master/lua/src/llex.c"
click node_parser "https://github.com/luadist/scite/blob/master/lua/src/lparser.c"
click node_codegen "https://github.com/luadist/scite/blob/master/lua/src/lcode.c"
click node_vm "https://github.com/luadist/scite/blob/master/lua/src/lvm.c"
click node_state "https://github.com/luadist/scite/blob/master/lua/src/lstate.c"
click node_stdlib "https://github.com/luadist/scite/blob/master/lua/src/lib/linit.c"
click node_loadlib "https://github.com/luadist/scite/blob/master/lua/src/lib/loadlib.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scite,node_platform,node_scintilla,node_user toneBlue
class node_file,node_worker toneAmber
class node_luaextension,node_luaapi toneMint
class node_lexer,node_parser,node_codegen,node_vm,node_state,node_stdlib,node_loadlib toneRose
class node_filesystem toneIndigo
```

## Components

### Editor

- [SciTE core](https://github.com/luadist/scite/blob/master/src/SciTEBase.h): `src/SciTEBase.h`
- [Platform UI](https://github.com/luadist/scite/blob/master/win32/SciTEWin.h): `win32/SciTEWin.h`
- **Scintilla editor**

### File work

- [File I/O](https://github.com/luadist/scite/blob/master/src/FileWorker.h): `src/FileWorker.h`
- [Worker framework](https://github.com/luadist/scite/blob/master/src/Worker.h): `src/Worker.h`

### Lua integration

- [Lua extension](https://github.com/luadist/scite/blob/master/src/LuaExtension.h): `src/LuaExtension.h`
- [Lua C API](https://github.com/luadist/scite/blob/master/lua/include/lua.h): `lua/include/lua.h`

### Lua runtime

- [Lexer](https://github.com/luadist/scite/blob/master/lua/src/llex.c): `lua/src/llex.c`
- [Parser](https://github.com/luadist/scite/blob/master/lua/src/lparser.c): `lua/src/lparser.c`
- [Code generation](https://github.com/luadist/scite/blob/master/lua/src/lcode.c): `lua/src/lcode.c`
- [Virtual machine](https://github.com/luadist/scite/blob/master/lua/src/lvm.c): `lua/src/lvm.c`
- [Runtime state](https://github.com/luadist/scite/blob/master/lua/src/lstate.c): `lua/src/lstate.c`
- [Standard libraries](https://github.com/luadist/scite/blob/master/lua/src/lib/linit.c): `lua/src/lib/linit.c`
- [Module loading](https://github.com/luadist/scite/blob/master/lua/src/lib/loadlib.c): `lua/src/lib/loadlib.c`

### Other components

- **Editor user**
- **Local files**

## Connections

- Editor user → Platform UI: operates
- Platform UI → SciTE core: handles UI
- SciTE core → Scintilla editor: editor operations
- SciTE core → File I/O: loads and saves
- File I/O → Local files: reads and writes
- File I/O → Worker framework: runs as
- Lua extension → Lua C API: uses API
- Lua C API → Runtime state: operates on
- Lexer → Parser: provides tokens
- Parser → Code generation: emits instructions
- Virtual machine → Runtime state: executes in
- Standard libraries → Lua C API: registers libraries
- Module loading → Runtime state: loads modules
