cluaupp 0.2.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +14 -75
  2. package/README.md +42 -88
  3. package/docs/README.md +25 -21
  4. package/docs/architecture.md +13 -76
  5. package/docs/cli.md +12 -64
  6. package/docs/comparison.md +6 -24
  7. package/docs/config.md +6 -7
  8. package/docs/cpp-advanced.md +6 -3
  9. package/docs/cpp-types.md +2 -0
  10. package/docs/examples/combat.md +19 -227
  11. package/docs/examples/hud.md +13 -81
  12. package/docs/examples/index.md +9 -16
  13. package/docs/examples/leaderstats.md +44 -115
  14. package/docs/getting-started.md +20 -135
  15. package/docs/intellisense.md +5 -42
  16. package/docs/intro.md +16 -15
  17. package/docs/libraries/dataservice.md +4 -1
  18. package/docs/libraries/index.md +2 -1
  19. package/docs/libraries/more.md +3 -1
  20. package/docs/libraries/ui.md +76 -0
  21. package/docs/migration.md +38 -0
  22. package/docs/oop/file-tags.md +12 -36
  23. package/docs/oop/index.md +18 -11
  24. package/docs/roblox-api.md +4 -56
  25. package/docs/syntax.md +54 -179
  26. package/editors/vscode/extension.js +1 -1
  27. package/editors/vscode/package.json +4 -4
  28. package/examples/README.md +5 -7
  29. package/examples/game/.vscode/extensions.json +2 -2
  30. package/examples/game/.vscode/settings.json +6 -23
  31. package/examples/game/src/client/hud.client.clpp +54 -0
  32. package/examples/game/src/client/init.client.clpp +6 -0
  33. package/examples/game/src/server/combat.server.clpp +85 -0
  34. package/examples/game/src/server/leaderstats.server.clpp +28 -0
  35. package/examples/game/src/shared/PlayerData.clh +20 -0
  36. package/examples/game/src/shared/config.clp +6 -0
  37. package/examples/game/src/shared/features.clp +88 -0
  38. package/generated/api.js +15 -1
  39. package/generated/cli.js +40 -24
  40. package/generated/clpp/contract.js +5 -0
  41. package/generated/clpp/index.js +27 -0
  42. package/generated/clpp/paths.js +121 -0
  43. package/generated/clpp/postprocess.js +78 -0
  44. package/generated/clpp/runner.js +102 -0
  45. package/generated/compile.js +26 -138
  46. package/generated/emit.js +79 -3
  47. package/generated/intellisense.js +83 -207
  48. package/generated/lex.js +3 -0
  49. package/generated/libs.js +1 -1
  50. package/generated/lsp.js +1 -8
  51. package/generated/parse.js +119 -24
  52. package/generated/preprocess.js +8 -179
  53. package/generated/system-understander.js +1 -1
  54. package/generated/transpile.js +3 -50
  55. package/generated/utils/project.js +13 -28
  56. package/include/{cluaupp/datatypes.hpp → clpp/datatypes.clh} +5 -1
  57. package/include/{cluaupp/generated/instances.hpp → clpp/generated/instances.clh} +1 -1
  58. package/include/{cluaupp/libs/chrono.hpp → clpp/libs/chrono.clh} +9 -9
  59. package/include/{cluaupp/libs/cmdr.hpp → clpp/libs/cmdr.clh} +4 -4
  60. package/include/{cluaupp/libs/dataservice.hpp → clpp/libs/dataservice.clh} +8 -15
  61. package/include/{cluaupp/libs/display.hpp → clpp/libs/display.clh} +1 -2
  62. package/include/{cluaupp/libs/ezvisual.hpp → clpp/libs/ezvisual.clh} +1 -3
  63. package/include/{cluaupp/libs/formatnumber.hpp → clpp/libs/formatnumber.clh} +2 -3
  64. package/include/{cluaupp/libs/fusion.hpp → clpp/libs/fusion.clh} +5 -5
  65. package/include/{cluaupp/libs/iris.hpp → clpp/libs/iris.clh} +2 -2
  66. package/include/{cluaupp/libs/janitor.hpp → clpp/libs/janitor.clh} +1 -2
  67. package/include/{cluaupp/libs/module3d.hpp → clpp/libs/module3d.clh} +2 -4
  68. package/include/{cluaupp/libs/net.hpp → clpp/libs/net.clh} +2 -4
  69. package/include/{cluaupp/libs/promise.hpp → clpp/libs/promise.clh} +1 -4
  70. package/include/{cluaupp/libs/spring.hpp → clpp/libs/spring.clh} +1 -2
  71. package/include/{cluaupp/libs/statemachine.hpp → clpp/libs/statemachine.clh} +2 -3
  72. package/include/{cluaupp/libs/stickybillboard.hpp → clpp/libs/stickybillboard.clh} +1 -2
  73. package/include/{cluaupp/libs/topbarplus.hpp → clpp/libs/topbarplus.clh} +3 -4
  74. package/include/clpp/libs.clh +24 -0
  75. package/include/clpp/roblox.clh +31 -0
  76. package/package.json +20 -16
  77. package/src/api.ts +15 -1
  78. package/src/cli.ts +39 -25
  79. package/src/clpp/contract.ts +39 -0
  80. package/src/clpp/index.ts +18 -0
  81. package/src/clpp/paths.ts +117 -0
  82. package/src/clpp/postprocess.ts +93 -0
  83. package/src/clpp/runner.ts +102 -0
  84. package/src/compile.ts +26 -149
  85. package/src/intellisense.ts +82 -211
  86. package/src/libs.ts +1 -1
  87. package/src/lsp.ts +1 -5
  88. package/src/preprocess.ts +8 -180
  89. package/src/system-understander.ts +1 -1
  90. package/src/transpile.ts +9 -52
  91. package/src/utils/project.ts +12 -28
  92. package/templates/game/.vscode/extensions.json +2 -2
  93. package/templates/game/.vscode/settings.json +6 -23
  94. package/templates/game/src/client/init.client.clpp +6 -0
  95. package/templates/game/src/server/leaderstats.server.clpp +29 -0
  96. package/templates/game/src/shared/config.clp +6 -0
  97. package/examples/game/.clangd +0 -25
  98. package/examples/game/.vscode/c_cpp_properties.json +0 -27
  99. package/examples/game/compile_flags.txt +0 -6
  100. package/examples/game/src/client/hud.client.cpp +0 -12
  101. package/examples/game/src/client/init.client.cpp +0 -6
  102. package/examples/game/src/server/combat.server.cpp +0 -23
  103. package/examples/game/src/server/leaderstats.server.cpp +0 -29
  104. package/examples/game/src/shared/config.cpp +0 -5
  105. package/examples/game/src/shared/config.h +0 -5
  106. package/include/cluaupp/libs.hpp +0 -25
  107. package/include/cluaupp/roblox.hpp +0 -47
  108. package/src/architecture.ts +0 -500
  109. package/src/ast.ts +0 -37
  110. package/src/emit.ts +0 -531
  111. package/src/emitter/luau-codegen.ts +0 -187
  112. package/src/emitter/translators.ts +0 -168
  113. package/src/headers.ts +0 -233
  114. package/src/layout.ts +0 -114
  115. package/src/lex.ts +0 -155
  116. package/src/parse.ts +0 -630
  117. package/src/parser/collector.ts +0 -148
  118. package/src/parser/index.ts +0 -27
  119. package/src/tree-sitter-cpp.d.ts +0 -4
  120. package/src/understand.ts +0 -322
  121. package/templates/game/.vscode/c_cpp_properties.json +0 -27
  122. package/templates/game/src/client/init.client.cpp +0 -6
  123. package/templates/game/src/server/leaderstats.server.cpp +0 -29
  124. package/templates/game/src/shared/config.cpp +0 -5
  125. package/templates/game/src/shared/config.h +0 -5
  126. /package/include/{cluaupp/generated/enums.hpp → clpp/generated/enums.clh} +0 -0
  127. /package/include/{cluaupp/libs/math.hpp → clpp/libs/math.clh} +0 -0
  128. /package/include/{cluaupp/libs/twinkle.hpp → clpp/libs/twinkle.clh} +0 -0
  129. /package/include/{cluaupp/libs/vfx.hpp → clpp/libs/vfx.clh} +0 -0
@@ -1,43 +1,31 @@
1
1
  # Getting started
2
2
 
3
- Cluaupp installs from **npm**, the same channel as roblox-ts and most Roblox tooling outside Studio.
3
+ Cluaupp is the **game toolchain**. [CL++](https://kartzrbx.github.io/CLPP/) is the **language**.
4
4
 
5
5
  ## Requirements
6
6
 
7
7
  - [Node.js](https://nodejs.org/) 18 or newer
8
- - [Rojo](https://rojo.space/) **7.7.0** to sync `out/` into Studio (`cluaupp init` writes `rokit.toml`; run `rokit install`)
9
- - LLVM clangd for C++ IntelliSense (Cursor / VS Code — installed by `cluaupp init`)
8
+ - [Rojo](https://rojo.space/) **7.7.0** (`cluaupp init` writes `rokit.toml`)
9
+ - **`clpp` on PATH** from [KartzRbx/CLPP](https://github.com/KartzRbx/CLPP)
10
10
 
11
- ## Install the compiler
11
+ ```bash
12
+ cargo install --path . # inside a CL++ checkout
13
+ clpp install # VS Code / Cursor language pack
14
+ ```
12
15
 
13
- Global (`cluaupp` on your PATH):
16
+ ## Install Cluaupp
14
17
 
15
18
  ```bash
16
19
  npm install -g cluaupp
17
20
  cluaupp --version
18
21
  ```
19
22
 
20
- Without a global install, via `npx`:
23
+ Or:
21
24
 
22
25
  ```bash
23
26
  npx cluaupp init my-game
24
27
  ```
25
28
 
26
- As a game dependency:
27
-
28
- ```bash
29
- npm install --save-dev cluaupp
30
- ```
31
-
32
- ```json
33
- {
34
- "scripts": {
35
- "build": "cluaupp build",
36
- "watch": "cluaupp watch"
37
- }
38
- }
39
- ```
40
-
41
29
  ## First game
42
30
 
43
31
  ```bash
@@ -48,130 +36,27 @@ cluaupp build
48
36
  rojo serve
49
37
  ```
50
38
 
51
- In Roblox Studio: install the Rojo plugin and connect to `localhost:34872` (default port).
52
-
53
- Generated layout:
54
-
55
39
  ```
56
40
  my-game/
57
41
  cluaupp.config.json
58
- default.project.json ← Rojo
59
- include/cluaupp/roblox.hpp
60
- include/cluaupp/libs/
61
- libs/ ← CluauppLibs (Janitor, Fusion, Cmdr, DataService, …)
62
- Packages/ ← optional extra Wally
63
- wally.toml
42
+ default.project.json
64
43
  src/
65
- server/leaderstats.server.cpp
66
- client/init.client.cpp
67
- shared/config.h
68
- shared/config.cpp
44
+ server/leaderstats.server.clpp
45
+ client/init.client.clpp
46
+ shared/config.clp
69
47
  out/ ← generated Luau (do not edit)
70
- server/leaderstats.server.luau
71
- client/init.client.luau
72
- shared/Config.luau
73
- ```
74
-
75
- ## Datatypes (Vector3, CFrame, UDim2)
76
-
77
- ```cpp
78
- #include <cluaupp/roblox.hpp>
79
-
80
- void init() {
81
- auto* part = new Part(workspace);
82
- part->Size = Vector3(8, 1, 8);
83
- part->Position = Vector3(0, 10, 0);
84
- part->CFrame = CFrame::lookAt(Vector3(0, 10, 0), Vector3(0, 10, -10));
85
- part->Color = Color3::fromRGB(255, 0, 0);
86
- part->Material = Enum::Material::Plastic;
87
-
88
- auto* frame = new Frame();
89
- frame->Size = UDim2::fromScale(1, 1);
90
- frame->Position = UDim2(0, 0, 0.5, 0);
91
- }
48
+ libs/ ← CluauppLibs
92
49
  ```
93
50
 
94
- This becomes `Vector3.new`, `CFrame.lookAt`, `Color3.fromRGB`, `UDim2.fromScale`, `Enum.Material.Plastic`.
51
+ ## Tiny program
95
52
 
96
- Full reference (every class from [create.roblox.com](https://create.roblox.com/docs/reference/engine)): [Cluaupp GitHub Pages](https://kartzrbx.github.io/Cluaupp/).
97
-
98
- ## How to write
99
-
100
- Every `.cpp` / `.h` / `.hpp` file can start with the IntelliSense header. Angle-bracket includes are ignored. Quoted `#include "config.h"` is inlined into the file.
101
-
102
- ```cpp
103
- #include <cluaupp/roblox.hpp>
104
-
105
- void CreateLeaderstats(Player* player) {
106
- if (player->FindFirstChild("leaderstats") != nullptr) {
107
- return;
108
- }
109
-
110
- auto* leaderstats = new Folder(player);
111
- leaderstats->Name = "leaderstats";
112
- }
53
+ ```clpp
54
+ #include <clpp/roblox.clh>
113
55
 
114
56
  void init() {
115
- auto* players = GetService<Players>();
116
- for (auto* player : players->GetPlayers()) {
117
- CreateLeaderstats(player);
118
- }
119
- players->PlayerAdded.Connect(CreateLeaderstats);
57
+ Players* players = GetService<Players>();
58
+ post("online: " .: players::GetPlayers());
120
59
  }
121
60
  ```
122
61
 
123
- If a file defines `void init()`, Cluaupp calls `init()` at the end of the `.luau`. Use that in Scripts and LocalScripts.
124
-
125
- ## IntelliSense
126
-
127
- `cluaupp init` writes clangd config and installs LLVM `clang++` plus the clangd editor extension when missing. Then reload the window. Completion is clangd; Cluaupp does not index C++ itself.
128
-
129
- ```bash
130
- cluaupp intellisense
131
- ```
132
-
133
- `#include <cluaupp/roblox.hpp>` at the top of each source file. The header is **not** compiled to Luau. clangd learns that path from `-Iinclude` in `.clangd`, `compile_flags.txt`, and `compile_commands.json` — it does not read `c_cpp_properties.json`.
134
-
135
- See [IntelliSense](intellisense.md).
136
-
137
- ## Watch
138
-
139
- ```bash
140
- cluaupp watch
141
- ```
142
-
143
- Saving a `.cpp`, `.h`, or `.hpp` under `src/` rebuilds the project. Keep Rojo running at the same time.
144
-
145
- ## Libraries
146
-
147
- `cluaupp build` copies runtime modules to `libs/` (Rojo: `ReplicatedStorage.CluauppLibs`). Include a header and the compiler injects `require`.
148
-
149
- ```cpp
150
- #include <cluaupp/libs/janitor.hpp>
151
- #include <cluaupp/libs/net.hpp>
152
-
153
- void init() {
154
- auto* janitor = new Janitor();
155
- auto* coins = Net::Event("Coins");
156
- janitor->Add(coins);
157
- }
158
- ```
159
-
160
- Wally is optional. Fusion, Cmdr, DataServiceV2, and the rest ship **inside** `libs/` (full GitHub source). See [Libraries](libraries/index.md) — start with [DataService Init](libraries/dataservice.md) and [Janitor](libraries/janitor.md).
161
-
162
- See [Libraries](libraries/index.md), [OOP](oop/index.md), [types](cpp-types.md), [safety](cpp-safety.md).
163
-
164
- ## Next
165
-
166
- - [C++ → Luau syntax](syntax.md)
167
- - [print and cout](print-cout.md)
168
- - [C++ types](cpp-types.md)
169
- - [const](cpp-const.md)
170
- - [Safety](cpp-safety.md)
171
- - [Organization](cpp-organization.md)
172
- - [Architecture](architecture.md)
173
- - [OOP structure](oop/index.md)
174
- - [Libraries](libraries/index.md)
175
- - [Examples](examples/index.md)
176
- - [Roblox API](roblox-api.md)
177
- - [CLI](cli.md)
62
+ Language course and reference: [kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/). Migrating `.cpp`: [migration](migration.md).
@@ -1,49 +1,12 @@
1
1
  # IntelliSense
2
2
 
3
- C++ completion, hover, and go-to-definition are **clangd**. Cluaupp does not ship a second completion engine.
4
-
5
- `cluaupp init` / `cluaupp intellisense` install:
6
-
7
- 1. [clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd) (`llvm-vs-code-extensions.vscode-clangd`)
8
- 2. LLVM `clang++` when missing (Windows: `winget install --id LLVM.LLVM -e`)
9
- 3. `.clangd`, `compile_flags.txt`, and `compile_commands.json` so clangd finds `include/` (clangd does **not** read `.vscode/c_cpp_properties.json`)
10
- 4. Forced include of `include/cluaupp/roblox.hpp` so `GetService`, `Player`, `Janitor` complete from the real C++ stubs
11
-
12
- Tree-sitter is the **compiler** frontend (collect → emit Luau). It is not an editor language server. A homemade tokenizer in the CLI would fight clangd — that path is gone.
13
-
14
- Microsoft `ms-vscode.cpptools` is **not** used. Two C++ engines in the same window fight; Cluaupp disables the Microsoft engine (`C_Cpp.intelliSenseEngine: Disabled`).
15
-
16
- `cluaupp lsp` only publishes **subset parse errors** (code that clangd may accept as C++ but Cluaupp will not transpile).
17
-
18
- ## Headers clangd must see
19
-
20
- `#include <cluaupp/roblox.hpp>` resolves only if `-Iinclude` is on the clangd compile flags. That maps to `include/cluaupp/roblox.hpp`. Angle-bracket includes are ignored by the transpiler.
21
-
22
- `cluaupp init` / `build` / `watch` / `intellisense` rewrite:
23
-
24
- - `-Iinclude` and `-Isrc`
25
- - `-include include/cluaupp/roblox.hpp`
26
- - one `compile_commands.json` entry per file under `src/`
27
-
28
- ## Install
3
+ CL++ highlighting, completion, and diagnostics come from **`clpp install`** ([KartzRbx/CLPP](https://github.com/KartzRbx/CLPP) language pack). Cluaupp does not ship clangd or a C++ engine.
29
4
 
30
5
  ```bash
31
- cluaupp intellisense
6
+ clpp install
7
+ cluaupp intellisense # writes files.associations for .clpp / .clp / .clh
32
8
  ```
33
9
 
34
- Reload: Command Palette → **Developer: Reload Window**. clangd should attach to `.cpp` files.
35
-
36
- `cluaupp build` / `watch` only refresh `compile_commands.json` (no download). They never keep deleted files in the compilation database.
37
-
38
- ## Config that ships
39
-
40
- | File | Role |
41
- | --- | --- |
42
- | `.vscode/c_cpp_properties.json` | compiler path (unused by clangd; kept if someone re-enables cpptools) |
43
- | `.vscode/settings.json` | `C_Cpp.intelliSenseEngine: Disabled`, `clangd.enable: true`, `--compile-commands-dir` |
44
- | `.vscode/extensions.json` | recommends `llvm-vs-code-extensions.vscode-clangd` |
45
- | `.clangd` | C++20, `-Iinclude`, skip `out/` and `libs/` |
46
- | `compile_flags.txt` | fallback flags if a file is not yet in `compile_commands.json` |
47
- | `compile_commands.json` | one entry per `src/` file |
10
+ Reload the editor. Language id is **`clpp`**, not `cpp`.
48
11
 
49
- `#include <cluaupp/roblox.hpp>` at the top of each source file. The header is not compiled to Luau.
12
+ `cluaupp lsp` can surface `clpp` compile errors over stdio; prefer the official CL++ extension for day-to-day editing.
package/docs/intro.md CHANGED
@@ -5,33 +5,34 @@ sidebar_position: 1
5
5
 
6
6
  # Cluaupp
7
7
 
8
- **The definitive merge of C++ and modern Luau.** You write a C++ subset. Cluaupp emits [Luau](https://luau.org/getting-started) with `local` and `const` (and `--!strict` when you opt in), and calls the Roblox API the way Studio does.
8
+ **CL++ on Roblox.** You write [CL++](https://kartzrbx.github.io/CLPP/). Cluaupp runs `clpp`, maps libraries into `ReplicatedStorage.CluauppLibs`, and syncs with Rojo.
9
9
 
10
- This site is built with [Moonwave](https://eryn.io/moonwave/) for local markdown (`npm run docs`). The **public** site is generated into `site/` and deployed to [GitHub Pages](https://kartzrbx.github.io/Cluaupp/) (Learn tabs, OOP, Examples, API). The language is in the same spirit as [roblox-ts](https://roblox-ts.com): a familiar syntax, a restricted subset, readable output.
10
+ This site covers the **toolchain** (`init`, `build`, `watch`, libs). The language course is on the [CL++ site](https://kartzrbx.github.io/CLPP/).
11
11
 
12
12
  ## What you get
13
13
 
14
- 1. A compiler (`cluaupp init` / `build` / `watch`)
15
- 2. Headers for **clangd** (`#include <cluaupp/roblox.hpp>`)
16
- 3. First-party libraries in `ReplicatedStorage.CluauppLibs`
17
- 4. Wally wrappers for DataServiceV2, Fusion, Cmdr, EzVisualz, TopbarPlus, and the rest of your stack
14
+ 1. CLI: `cluaupp init` / `build` / `watch`
15
+ 2. First-party libraries in `ReplicatedStorage.CluauppLibs`
16
+ 3. Rojo project mapping (`out/server`, `out/client`, `out/shared`)
18
17
 
19
18
  ## First program
20
19
 
21
- ```cpp
22
- #include <cluaupp/roblox.hpp>
23
- #include <cluaupp/libs/janitor.hpp>
20
+ ```clpp
21
+ #include <clpp/roblox.clh>
22
+ #include <clpp/libs/janitor.clh>
24
23
 
25
24
  void OnPlayer(Player* player) {
26
- auto* janitor = new Janitor();
27
- janitor->LinkToInstance(player);
28
- janitor->Add(player->AncestryChanged.Connect(OnPlayer));
25
+ guard (player != null) else {
26
+ return;
27
+ }
28
+ Janitor* janitor = new Janitor();
29
+ janitor::LinkToInstance(player);
29
30
  }
30
31
 
31
32
  void init() {
32
- auto* players = GetService<Players>();
33
- players->PlayerAdded.Connect(OnPlayer);
33
+ Players* players = GetService<Players>();
34
+ players::PlayerAdded~>Connect(OnPlayer);
34
35
  }
35
36
  ```
36
37
 
37
- Read [Getting started](getting-started.md), then [Examples](examples/index.md), [Libraries](libraries/index.md), and [OOP structure](oop/index.md).
38
+ Read [Getting started](getting-started.md), [syntax](syntax.md), and [migration](migration.md).
@@ -91,9 +91,12 @@ void OnCurrenciesChanged() {
91
91
  }
92
92
 
93
93
  data->GetChangedSignal(DataService::Server.Paths.Currencies).Connect(OnCurrenciesChanged);
94
+ data->GetChangedSignal(DataService::Server.Paths.Currencies.Coins).Connect([](int coins) {
95
+ print(coins);
96
+ });
94
97
  ```
95
98
 
96
- `GetChangedSignal` fires when that path (or a child) changes. Cluaupp has no lambdas — use a named function.
99
+ `GetChangedSignal` fires when that path (or a child) changes. Use a named function or a lambda (`[](int newValue) { ... }`).
97
100
 
98
101
  ## Rules
99
102
 
@@ -13,7 +13,8 @@ sidebar_position: 1
13
13
  | [Janitor](janitor.md) | Connections, instances, cleanup on leave |
14
14
  | [Promise](promise.md) | Delay, Then / Catch / Await |
15
15
  | [Net](net.md) | RemoteEvent / RemoteFunction without making remotes |
16
- | [More libraries](more.md) | FormatNumber, Fusion, Cmdr, Twinkle, MathUtils, … |
16
+ | [Declarative UI](ui.md) | Fusion, Iris, Vide, React/Roact — no JSX |
17
+ | [More libraries](more.md) | FormatNumber, Twinkle, TopbarPlus, EzVisualz, … |
17
18
 
18
19
  Sources: [runtime/SOURCES.md](https://github.com/KartzRbx/Cluaupp/blob/main/runtime/SOURCES.md). Re-vendor: `node scripts/vendor-libs.js`.
19
20
 
@@ -60,7 +60,9 @@ billboard->SetText("Hello");
60
60
 
61
61
  ## Fusion / Iris / Cmdr / TopbarPlus / Chrono / EzVisualz / StateMachine / Spring / Display
62
62
 
63
- These are the GitHub systems behind typed `init.luau` borders. Include the matching `<cluaupp/libs/*.hpp>` and call the same names as the upstream README. Cluaupp does not re-document every Fusion `Value` / Cmdr command — use:
63
+ Cluaupp has **no JSX**. Declarative UI is function calls. First-party: Fusion (reactive) and Iris (immediate-mode debug). Vide and Roact/React use the same C++ spelling (`createElement` / `source`), not `<frame />`. Handbook: [Declarative UI](https://kartzrbx.github.io/Cluaupp/docs/ui.html).
64
+
65
+ Include the matching `<cluaupp/libs/*.hpp>` and call the same names as the upstream README:
64
66
 
65
67
  | Lib | Header | Upstream |
66
68
  | --- | --- | --- |
@@ -0,0 +1,76 @@
1
+ ---
2
+ title: Declarative UI
3
+ sidebar_position: 5
4
+ ---
5
+
6
+ # Declarative UI
7
+
8
+ Live handbook (examples, C++ / Luau tabs): **[Declarative UI](https://kartzrbx.github.io/Cluaupp/docs/ui.html)**.
9
+
10
+ roblox-ts can compile [Roact JSX](https://roblox-ts.com/docs/guides/roact-jsx) because TypeScript has JSX. **Cluaupp does not.** There are no `<frame />` tags. You call the library the way Luau does: functions, designated-initializer tables, lambdas.
11
+
12
+ ## Pick a model
13
+
14
+ | When you want… | Use | In Cluaupp |
15
+ | --- | --- | --- |
16
+ | A few labels you set by hand | Imperative Instances | `new TextLabel(gui)` |
17
+ | UI that follows state | [Fusion](https://github.com/dphfox/Fusion) | Shipped: `#include <cluaupp/libs/fusion.hpp>` |
18
+ | The same idea, sources | [Vide](https://github.com/centau/vide) | Not shipped — calling convention on the handbook |
19
+ | A virtual tree | Roact / [jsdotlua React](https://github.com/jsdotlua/react) | Not shipped — `createElement`, never JSX |
20
+ | Studio debug panels | [Iris](https://github.com/SirMallard/Iris) | Shipped: `#include <cluaupp/libs/iris.hpp>` |
21
+ | Topbar / fade / rainbow | TopbarPlus, Twinkle, EzVisualz | Shipped — polish Instances you already have |
22
+
23
+ Fusion and Iris are in CluauppLibs. Vide and React/Roact are **not** vendored.
24
+
25
+ ## JSX → Cluaupp
26
+
27
+ | roblox-ts JSX | Cluaupp |
28
+ | --- | --- |
29
+ | `<frame Size={u} />` | `React::createElement("Frame", { .Size = u })` |
30
+ | `<textlabel Key="Coins" />` | `.Key = "Coins"` on the props table |
31
+ | `Event={{ Activated: fn }}` | `.Event = { .Activated = fn }` |
32
+ | `<MyButton text="Buy" />` | `React::createElement(MyButton, { .text = "Buy" })` |
33
+
34
+ ## Fusion (shipped)
35
+
36
+ ```cpp
37
+ #include <cluaupp/libs/fusion.hpp>
38
+
39
+ FusionScope scope = Fusion::scoped();
40
+ FusionState coins = Fusion::Value(0);
41
+ Fusion::New("TextLabel")({
42
+ .Name = "Coins",
43
+ .Parent = gui,
44
+ .Size = UDim2::fromScale(1, 0.1),
45
+ });
46
+ ```
47
+
48
+ Wire `coins(newValue)` from `DataService::Client` `GetChangedSignal(Paths.Currencies.Coins)`. Use `Computed` for strings, `Hydrate` for a ScreenGui that already exists in Studio, `Spring` / `Tween` for motion.
49
+
50
+ ## Vide / React
51
+
52
+ Same subset: **no JSX**. Vide is `source` / `derive` / `create("TextLabel")({ .Parent = gui })`. React is `createElement("Frame", { .Key = "Child" }, child)` plus `Key`, `Ref`, `Change`, `Event` as table fields. Full copies with C++ / Luau tabs: the [handbook page](https://kartzrbx.github.io/Cluaupp/docs/ui.html).
53
+
54
+ ## Iris (shipped, debug only)
55
+
56
+ ```cpp
57
+ #include <cluaupp/libs/iris.hpp>
58
+
59
+ void DrawEconomy() {
60
+ if (Iris::Window("Economy")) {
61
+ Iris::Text("Coins");
62
+ Iris::End();
63
+ }
64
+ }
65
+
66
+ void init() {
67
+ Iris::Init();
68
+ Iris::Connect(DrawEconomy);
69
+ }
70
+ ```
71
+
72
+ Do not use Iris as the live player HUD. Pair every `Window` / `Tree` with `End()`.
73
+
74
+ ## One owner per ScreenGui
75
+
76
+ Do not mount Fusion and React on the same gui. Twinkle / TopbarPlus / EzVisualz can decorate that owner’s Instances. Client code must not `Set` persisted DataService paths.
@@ -0,0 +1,38 @@
1
+ # Migrate C++ games to CL++
2
+
3
+ Cluaupp 1.0 compiles **CL++**, not a C++ subset. Language docs: [kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/).
4
+
5
+ ## Files
6
+
7
+ | Before | After |
8
+ | --- | --- |
9
+ | `*.server.cpp` | `*.server.clpp` |
10
+ | `*.client.cpp` | `*.client.clpp` |
11
+ | untagged `*.cpp` | `*.clp` |
12
+ | `*.h` / `*.hpp` | `*.clh` |
13
+
14
+ `#include <cluaupp/roblox.hpp>` → `#include <clpp/roblox.clh>`
15
+ `#include <cluaupp/libs/janitor.hpp>` → `#include <clpp/libs/janitor.clh>`
16
+ Quoted includes: `"leaderstats.h"` → `"leaderstats.clh"`.
17
+
18
+ ## Operators and IO
19
+
20
+ | Old C++ subset | CL++ | Luau |
21
+ | --- | --- | --- |
22
+ | `player->Name` | `player.Name` | `.` |
23
+ | `player->GetPlayers()` | `player::GetPlayers()` | `:` |
24
+ | `DataService::Server` | `DataService:Server` | `.` |
25
+ | `"hi " + name` | `"hi " .: name` | `..` |
26
+ | `signal.Connect(fn)` | `signal~>Connect(fn)` | Janitor `Add` |
27
+ | `print` / `error` | `post` / `report` | `print` / `error` |
28
+ | `nullptr` | `null` | `nil` |
29
+ | `[](Player* p) { }` | `func [](Player* p) { }` | `function` |
30
+
31
+ ## Workflow
32
+
33
+ 1. Install CL++: [github.com/KartzRbx/CLPP](https://github.com/KartzRbx/CLPP) (`cargo install --path .`).
34
+ 2. `clpp install` (editor highlighting + IntelliSense).
35
+ 3. Rename sources and apply the table above.
36
+ 4. `cluaupp build` — `clpp` must be on PATH (`CLPP_PATH` if needed).
37
+
38
+ `"architecture": true` (ForeverHD folders) is not generated in 1.0. One source file still becomes one `.luau` file.
@@ -5,44 +5,20 @@ sidebar_position: 2
5
5
 
6
6
  # File tags
7
7
 
8
- The **filename** decides the Roblox instance. This is the same key idea as roblox-ts (`*.server.ts` → Script).
8
+ The **filename** decides the Roblox instance (same idea as roblox-ts).
9
9
 
10
- | Source | Instance | RunContext |
11
- | --- | --- | --- |
12
- | `LeaderstatsServer.server.cpp` | **Script** | **Server** |
13
- | `DataBoot.client.cpp` | **LocalScript** | Client |
14
- | `Tools.plugin.cpp` | **Script** | Plugin |
15
- | `Boot.legacy.cpp` | Script | **Legacy** |
16
- | `Boot.legacy.server.cpp` | Script | **Legacy** |
17
- | `Boot.legacy.client.cpp` | LocalScript | Legacy |
18
- | `Damage.cpp` (no tag) | **ModuleScript** | — |
19
- | `LeaderstatsServer.h` | **ModuleScript** (types) | — |
20
- | `LeaderstatsServer.cpp` (sibling of `.h`) | **ModuleScript** (`*Impl`) | — |
21
-
22
- ## One file in, one file out
23
-
24
- Rojo infers the instance from the filename key: `*.server.luau` is a Script, `*.client.luau` is a LocalScript, untagged `.luau` is a ModuleScript.
10
+ | Source | Instance |
11
+ | --- | --- |
12
+ | `LeaderstatsServer.server.clpp` | Script |
13
+ | `Hud.client.clpp` | LocalScript |
14
+ | `Tools.plugin.clpp` | Plugin Script |
15
+ | `damage.clp` (no tag) | ModuleScript |
16
+ | `PlayerData.clh` | ModuleScript |
25
17
 
26
18
  ```
27
- src/server/boot/DataBoot.server.cpp → out/server/boot/DataBoot.server.luau
28
- src/client/boot/DataBoot.client.cpp → out/client/boot/DataBoot.client.luau
29
- src/shared/damage.cpp → out/shared/Damage.luau
30
- src/server/services/leaderstats/LeaderstatsServer.h → LeaderstatsServer.luau (export type)
31
- src/server/services/leaderstats/LeaderstatsServer.cpp → LeaderstatsServerImpl.luau
19
+ src/server/boot/DataBoot.server.clpp → out/server/boot/DataBoot.server.luau
20
+ src/client/hud.client.clpp → out/client/hud.client.luau
21
+ src/shared/config.clp → out/shared/config.luau
32
22
  ```
33
23
 
34
- `.legacy.server.cpp` still emits a Legacy Script (`boot.server.luau`). `.client.cpp` stays a LocalScript. Do not invent `init.meta.json` on the default 1:1 path.
35
-
36
- ## Where files live
37
-
38
- ```
39
- src/server/.../*.server.cpp → out/server (ServerScriptService.Cluaupp)
40
- src/client/.../*.client.cpp → out/client (StarterPlayerScripts.Cluaupp)
41
- src/shared/.../*.cpp → out/shared (ReplicatedStorage.Cluaupp)
42
- ```
43
-
44
- Name the **system**, not `init.server.cpp`. `LeaderstatsServer.server.cpp` and `DataBoot.server.cpp` are two files.
45
-
46
- ## Opt-in planner
47
-
48
- `"architecture": true` in `cluaupp.config.json` restores PascalCase service folders (`Main`, Controller, Types). Default is off.
24
+ Language details: [CL++ docs](https://kartzrbx.github.io/CLPP/).
package/docs/oop/index.md CHANGED
@@ -3,20 +3,27 @@ title: OOP structure
3
3
  sidebar_position: 1
4
4
  ---
5
5
 
6
- # OOP structure
6
+ # Structs and methods
7
7
 
8
- The **live site** (not just these markdown files) is GitHub Pages:
8
+ Language details: [CL++](https://kartzrbx.github.io/CLPP/). Filename tags decide Script / LocalScript / ModuleScript.
9
9
 
10
- - [Learn → OOP structure](https://kartzrbx.github.io/Cluaupp/learn/index.html)
11
- - [Guide → OOP](https://kartzrbx.github.io/Cluaupp/guide/oop.html)
12
- - [Examples](https://kartzrbx.github.io/Cluaupp/guide/examples.html)
10
+ Declare the type in a `.clh`, implement `Class::Method` in a `.clp` / `.clpp`. Capture one service table in `void init()`.
13
11
 
14
- Cluaupp does **not** compile custom C++ `class` types yet. “OOP” here is how you **lay out systems** so Studio gets Script / LocalScript / ModuleScript from the filename tag — the same idea as roblox-ts. Flamework-style Start/Stop folders are opt-in (`"architecture": true`).
12
+ ```clpp
13
+ #pragma once
14
+ #include <clpp/roblox.clh>
15
+ #include <clpp/libs/janitor.clh>
16
+
17
+ struct LeaderstatsServer {
18
+ static constexpr int STARTING_COINS = 0;
19
+ Janitor* janitor;
20
+ string GetPlayerJanitorKey(Player* player);
21
+ void PlayerEntered(Player* player);
22
+ };
23
+ ```
15
24
 
16
25
  | Page | What you learn |
17
26
  | --- | --- |
18
- | [File tags](file-tags.md) | `.server` / `.client` / `.plugin` / `.legacy` / untagged |
19
- | [Services](services.md) | One `.server.cpp` → one `.server.luau` |
20
- | [Modules](modules.md) | Untagged files, structs, named functions as methods |
21
-
22
- Planner details: [Architecture](../architecture.md). Folder layout: [Organization](../cpp-organization.md). Full services: [Examples](../examples/index.md).
27
+ | [File tags](file-tags.md) | `.server.clpp` / `.client.clpp` / `.clh` |
28
+ | [Services](services.md) | `init()` singletons |
29
+ | [Modules](modules.md) | shared `.clp` |
@@ -1,16 +1,10 @@
1
1
  # Roblox API
2
2
 
3
- Cluaupp covers the engine API listed on [create.roblox.com](https://create.roblox.com/docs/reference/engine): **925 classes**, **636 enums**, and the datatypes (`Vector3`, `CFrame`, `UDim`, `UDim2`, …).
3
+ Cluaupp uses the official engine. Spell the call in C++; look up members on [create.roblox.com](https://create.roblox.com/docs/reference/engine). The GitHub Pages site is a **language handbook**, not a dump of every Enum item.
4
4
 
5
- The **page-by-page** reference (every property, method, and event, with C++ and Luau) lives on the generated site:
5
+ Handbook: **[Docs](https://kartzrbx.github.io/Cluaupp/docs/)** · [Roblox in Cluaupp](https://kartzrbx.github.io/Cluaupp/docs/engine.html)
6
6
 
7
- **[Cluaupp docs (GitHub Pages)](https://kartzrbx.github.io/Cluaupp/)**
8
-
9
- - [Datatypes](https://kartzrbx.github.io/Cluaupp/api/datatypes/)
10
- - [Classes](https://kartzrbx.github.io/Cluaupp/api/classes/)
11
- - [Enums](https://kartzrbx.github.io/Cluaupp/api/enums/)
12
-
13
- In C++, `#include <cluaupp/roblox.hpp>`. The compiler ignores the header and emits real Luau.
7
+ `#include <cluaupp/roblox.hpp>` is IntelliSense. The compiler ignores the header and emits real Luau.
14
8
 
15
9
  ## Datatypes
16
10
 
@@ -20,7 +14,6 @@ part->Position = Vector3(0, 10, 0);
20
14
  part->CFrame = CFrame::lookAt(Vector3(0, 10, 0), Vector3(0, 10, -10));
21
15
  part->Color = Color3::fromRGB(255, 0, 0);
22
16
  frame->Size = UDim2::fromScale(1, 1);
23
- frame->Position = UDim2(0, 0, 0.5, 0);
24
17
  auto material = Enum::Material::Plastic;
25
18
  ```
26
19
 
@@ -30,52 +23,7 @@ part.Position = Vector3.new(0, 10, 0)
30
23
  part.CFrame = CFrame.lookAt(Vector3.new(0, 10, 0), Vector3.new(0, 10, -10))
31
24
  part.Color = Color3.fromRGB(255, 0, 0)
32
25
  frame.Size = UDim2.fromScale(1, 1)
33
- frame.Position = UDim2.new(0, 0, 0.5, 0)
34
26
  local material = Enum.Material.Plastic
35
27
  ```
36
28
 
37
- | C++ | Luau |
38
- | --- | --- |
39
- | `Vector3(x, y, z)` | `Vector3.new(x, y, z)` |
40
- | `Vector2(x, y)` | `Vector2.new(x, y)` |
41
- | `CFrame(x, y, z)` | `CFrame.new(x, y, z)` |
42
- | `CFrame::lookAt(from, look)` | `CFrame.lookAt(from, look)` |
43
- | `UDim(scale, offset)` | `UDim.new(scale, offset)` |
44
- | `UDim2(xs, xo, ys, yo)` | `UDim2.new(xs, xo, ys, yo)` |
45
- | `UDim2::fromScale(x, y)` | `UDim2.fromScale(x, y)` |
46
- | `UDim2::fromOffset(x, y)` | `UDim2.fromOffset(x, y)` |
47
- | `Color3::fromRGB(r, g, b)` | `Color3.fromRGB(r, g, b)` |
48
- | `Color3::fromHSV(h, s, v)` | `Color3.fromHSV(h, s, v)` |
49
- | `BrickColor("Bright red")` | `BrickColor.new("Bright red")` |
50
- | `Enum::Material::Plastic` | `Enum.Material.Plastic` |
51
- | `Rect(x0, y0, x1, y1)` | `Rect.new(x0, y0, x1, y1)` |
52
- | `Ray(origin, direction)` | `Ray.new(origin, direction)` |
53
- | `NumberRange(min, max)` | `NumberRange.new(min, max)` |
54
- | `TweenInfo(time, style)` | `TweenInfo.new(time, style)` |
55
-
56
- ## Instances and services
57
-
58
- ```cpp
59
- auto* part = new Part(workspace);
60
- auto* players = GetService<Players>();
61
- player->FindFirstChild("leaderstats");
62
- players->GetPlayers();
63
- ```
64
-
65
- ```luau
66
- local part: Part = Instance.new("Part")
67
- part.Parent = workspace
68
- local players: Players = game:GetService("Players")
69
- player:FindFirstChild("leaderstats")
70
- players:GetPlayers()
71
- ```
72
-
73
- `new Class(parent)` is for creatable classes (`Instance.new`). Services use `GetService<Name>()`.
74
-
75
- Generated headers (official client dump):
76
-
77
- - `include/cluaupp/datatypes.hpp`
78
- - `include/cluaupp/generated/enums.hpp`
79
- - `include/cluaupp/generated/instances.hpp`
80
-
81
- To regenerate: `npm run generate-api` in the `cluau/` folder.
29
+ Every enum is `Enum::Name::Item` → `Enum.Name.Item`. Services are `GetService<Players>()`. Instances are `new Folder(parent)` and `player->FindFirstChild("x")`.