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.
- package/CHANGELOG.md +14 -75
- package/README.md +42 -88
- package/docs/README.md +25 -21
- package/docs/architecture.md +13 -76
- package/docs/cli.md +12 -64
- package/docs/comparison.md +6 -24
- package/docs/config.md +6 -7
- package/docs/cpp-advanced.md +6 -3
- package/docs/cpp-types.md +2 -0
- package/docs/examples/combat.md +19 -227
- package/docs/examples/hud.md +13 -81
- package/docs/examples/index.md +9 -16
- package/docs/examples/leaderstats.md +44 -115
- package/docs/getting-started.md +20 -135
- package/docs/intellisense.md +5 -42
- package/docs/intro.md +16 -15
- package/docs/libraries/dataservice.md +4 -1
- package/docs/libraries/index.md +2 -1
- package/docs/libraries/more.md +3 -1
- package/docs/libraries/ui.md +76 -0
- package/docs/migration.md +38 -0
- package/docs/oop/file-tags.md +12 -36
- package/docs/oop/index.md +18 -11
- package/docs/roblox-api.md +4 -56
- package/docs/syntax.md +54 -179
- package/editors/vscode/extension.js +1 -1
- package/editors/vscode/package.json +4 -4
- package/examples/README.md +5 -7
- package/examples/game/.vscode/extensions.json +2 -2
- package/examples/game/.vscode/settings.json +6 -23
- package/examples/game/src/client/hud.client.clpp +54 -0
- package/examples/game/src/client/init.client.clpp +6 -0
- package/examples/game/src/server/combat.server.clpp +85 -0
- package/examples/game/src/server/leaderstats.server.clpp +28 -0
- package/examples/game/src/shared/PlayerData.clh +20 -0
- package/examples/game/src/shared/config.clp +6 -0
- package/examples/game/src/shared/features.clp +88 -0
- package/generated/api.js +15 -1
- package/generated/cli.js +40 -24
- package/generated/clpp/contract.js +5 -0
- package/generated/clpp/index.js +27 -0
- package/generated/clpp/paths.js +121 -0
- package/generated/clpp/postprocess.js +78 -0
- package/generated/clpp/runner.js +102 -0
- package/generated/compile.js +26 -138
- package/generated/emit.js +79 -3
- package/generated/intellisense.js +83 -207
- package/generated/lex.js +3 -0
- package/generated/libs.js +1 -1
- package/generated/lsp.js +1 -8
- package/generated/parse.js +119 -24
- package/generated/preprocess.js +8 -179
- package/generated/system-understander.js +1 -1
- package/generated/transpile.js +3 -50
- package/generated/utils/project.js +13 -28
- package/include/{cluaupp/datatypes.hpp → clpp/datatypes.clh} +5 -1
- package/include/{cluaupp/generated/instances.hpp → clpp/generated/instances.clh} +1 -1
- package/include/{cluaupp/libs/chrono.hpp → clpp/libs/chrono.clh} +9 -9
- package/include/{cluaupp/libs/cmdr.hpp → clpp/libs/cmdr.clh} +4 -4
- package/include/{cluaupp/libs/dataservice.hpp → clpp/libs/dataservice.clh} +8 -15
- package/include/{cluaupp/libs/display.hpp → clpp/libs/display.clh} +1 -2
- package/include/{cluaupp/libs/ezvisual.hpp → clpp/libs/ezvisual.clh} +1 -3
- package/include/{cluaupp/libs/formatnumber.hpp → clpp/libs/formatnumber.clh} +2 -3
- package/include/{cluaupp/libs/fusion.hpp → clpp/libs/fusion.clh} +5 -5
- package/include/{cluaupp/libs/iris.hpp → clpp/libs/iris.clh} +2 -2
- package/include/{cluaupp/libs/janitor.hpp → clpp/libs/janitor.clh} +1 -2
- package/include/{cluaupp/libs/module3d.hpp → clpp/libs/module3d.clh} +2 -4
- package/include/{cluaupp/libs/net.hpp → clpp/libs/net.clh} +2 -4
- package/include/{cluaupp/libs/promise.hpp → clpp/libs/promise.clh} +1 -4
- package/include/{cluaupp/libs/spring.hpp → clpp/libs/spring.clh} +1 -2
- package/include/{cluaupp/libs/statemachine.hpp → clpp/libs/statemachine.clh} +2 -3
- package/include/{cluaupp/libs/stickybillboard.hpp → clpp/libs/stickybillboard.clh} +1 -2
- package/include/{cluaupp/libs/topbarplus.hpp → clpp/libs/topbarplus.clh} +3 -4
- package/include/clpp/libs.clh +24 -0
- package/include/clpp/roblox.clh +31 -0
- package/package.json +20 -16
- package/src/api.ts +15 -1
- package/src/cli.ts +39 -25
- package/src/clpp/contract.ts +39 -0
- package/src/clpp/index.ts +18 -0
- package/src/clpp/paths.ts +117 -0
- package/src/clpp/postprocess.ts +93 -0
- package/src/clpp/runner.ts +102 -0
- package/src/compile.ts +26 -149
- package/src/intellisense.ts +82 -211
- package/src/libs.ts +1 -1
- package/src/lsp.ts +1 -5
- package/src/preprocess.ts +8 -180
- package/src/system-understander.ts +1 -1
- package/src/transpile.ts +9 -52
- package/src/utils/project.ts +12 -28
- package/templates/game/.vscode/extensions.json +2 -2
- package/templates/game/.vscode/settings.json +6 -23
- package/templates/game/src/client/init.client.clpp +6 -0
- package/templates/game/src/server/leaderstats.server.clpp +29 -0
- package/templates/game/src/shared/config.clp +6 -0
- package/examples/game/.clangd +0 -25
- package/examples/game/.vscode/c_cpp_properties.json +0 -27
- package/examples/game/compile_flags.txt +0 -6
- package/examples/game/src/client/hud.client.cpp +0 -12
- package/examples/game/src/client/init.client.cpp +0 -6
- package/examples/game/src/server/combat.server.cpp +0 -23
- package/examples/game/src/server/leaderstats.server.cpp +0 -29
- package/examples/game/src/shared/config.cpp +0 -5
- package/examples/game/src/shared/config.h +0 -5
- package/include/cluaupp/libs.hpp +0 -25
- package/include/cluaupp/roblox.hpp +0 -47
- package/src/architecture.ts +0 -500
- package/src/ast.ts +0 -37
- package/src/emit.ts +0 -531
- package/src/emitter/luau-codegen.ts +0 -187
- package/src/emitter/translators.ts +0 -168
- package/src/headers.ts +0 -233
- package/src/layout.ts +0 -114
- package/src/lex.ts +0 -155
- package/src/parse.ts +0 -630
- package/src/parser/collector.ts +0 -148
- package/src/parser/index.ts +0 -27
- package/src/tree-sitter-cpp.d.ts +0 -4
- package/src/understand.ts +0 -322
- package/templates/game/.vscode/c_cpp_properties.json +0 -27
- package/templates/game/src/client/init.client.cpp +0 -6
- package/templates/game/src/server/leaderstats.server.cpp +0 -29
- package/templates/game/src/shared/config.cpp +0 -5
- package/templates/game/src/shared/config.h +0 -5
- /package/include/{cluaupp/generated/enums.hpp → clpp/generated/enums.clh} +0 -0
- /package/include/{cluaupp/libs/math.hpp → clpp/libs/math.clh} +0 -0
- /package/include/{cluaupp/libs/twinkle.hpp → clpp/libs/twinkle.clh} +0 -0
- /package/include/{cluaupp/libs/vfx.hpp → clpp/libs/vfx.clh} +0 -0
package/docs/getting-started.md
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
# Getting started
|
|
2
2
|
|
|
3
|
-
Cluaupp
|
|
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**
|
|
9
|
-
-
|
|
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
|
-
|
|
11
|
+
```bash
|
|
12
|
+
cargo install --path . # inside a CL++ checkout
|
|
13
|
+
clpp install # VS Code / Cursor language pack
|
|
14
|
+
```
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
## Install Cluaupp
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
19
|
npm install -g cluaupp
|
|
17
20
|
cluaupp --version
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
|
|
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
|
|
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.
|
|
66
|
-
client/init.client.
|
|
67
|
-
shared/config.
|
|
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
|
-
|
|
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
|
-
|
|
51
|
+
## Tiny program
|
|
95
52
|
|
|
96
|
-
|
|
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
|
-
|
|
116
|
-
|
|
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
|
-
|
|
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).
|
package/docs/intellisense.md
CHANGED
|
@@ -1,49 +1,12 @@
|
|
|
1
1
|
# IntelliSense
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
6
|
+
clpp install
|
|
7
|
+
cluaupp intellisense # writes files.associations for .clpp / .clp / .clh
|
|
32
8
|
```
|
|
33
9
|
|
|
34
|
-
Reload
|
|
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
|
-
|
|
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
|
-
**
|
|
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
|
|
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.
|
|
15
|
-
2.
|
|
16
|
-
3.
|
|
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
|
-
```
|
|
22
|
-
#include <
|
|
23
|
-
#include <
|
|
20
|
+
```clpp
|
|
21
|
+
#include <clpp/roblox.clh>
|
|
22
|
+
#include <clpp/libs/janitor.clh>
|
|
24
23
|
|
|
25
24
|
void OnPlayer(Player* player) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
33
|
-
players
|
|
33
|
+
Players* players = GetService<Players>();
|
|
34
|
+
players::PlayerAdded~>Connect(OnPlayer);
|
|
34
35
|
}
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
Read [Getting started](getting-started.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.
|
|
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
|
|
package/docs/libraries/index.md
CHANGED
|
@@ -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
|
-
| [
|
|
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
|
|
package/docs/libraries/more.md
CHANGED
|
@@ -60,7 +60,9 @@ billboard->SetText("Hello");
|
|
|
60
60
|
|
|
61
61
|
## Fusion / Iris / Cmdr / TopbarPlus / Chrono / EzVisualz / StateMachine / Spring / Display
|
|
62
62
|
|
|
63
|
-
|
|
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.
|
package/docs/oop/file-tags.md
CHANGED
|
@@ -5,44 +5,20 @@ sidebar_position: 2
|
|
|
5
5
|
|
|
6
6
|
# File tags
|
|
7
7
|
|
|
8
|
-
The **filename** decides the Roblox instance
|
|
8
|
+
The **filename** decides the Roblox instance (same idea as roblox-ts).
|
|
9
9
|
|
|
10
|
-
| Source | Instance |
|
|
11
|
-
| --- | --- |
|
|
12
|
-
| `LeaderstatsServer.server.
|
|
13
|
-
| `
|
|
14
|
-
| `Tools.plugin.
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
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.
|
|
28
|
-
src/client/
|
|
29
|
-
src/shared/
|
|
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
|
-
|
|
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
|
-
#
|
|
6
|
+
# Structs and methods
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Language details: [CL++](https://kartzrbx.github.io/CLPP/). Filename tags decide Script / LocalScript / ModuleScript.
|
|
9
9
|
|
|
10
|
-
|
|
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
|
-
|
|
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` / `.
|
|
19
|
-
| [Services](services.md) |
|
|
20
|
-
| [Modules](modules.md) |
|
|
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` |
|
package/docs/roblox-api.md
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
# Roblox API
|
|
2
2
|
|
|
3
|
-
Cluaupp
|
|
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
|
-
|
|
5
|
+
Handbook: **[Docs](https://kartzrbx.github.io/Cluaupp/docs/)** · [Roblox in Cluaupp](https://kartzrbx.github.io/Cluaupp/docs/engine.html)
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
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")`.
|