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/CHANGELOG.md
CHANGED
|
@@ -1,81 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.0.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Breaking: Cluaupp no longer transpiles a C++ subset. Games are **CL++** (`.clpp` / `.clp` / `.clh`). The CLI orchestrates the [`clpp`](https://github.com/KartzRbx/CLPP) binary (`clpp api compile`), post-processes Luau (`ClppLibs` → `ReplicatedStorage.CluauppLibs`), and writes `out/` for Rojo.
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Requires `clpp` on PATH (`CLPP_PATH` override). Language, IntelliSense, and codegen live in CL++ (`clpp install`).
|
|
8
|
+
- `cluaupp language` prints `clpp api manifest`.
|
|
9
|
+
- Templates and `examples/game` use CL++ syntax (`guard`, `match`, `signal`, `.:`, `::`, Fusion).
|
|
10
|
+
- Docs site and README are CL++ × Luau (no clangd / `.cpp` toolchain).
|
|
11
|
+
- Tree-sitter C++ frontend removed. ForeverHD `"architecture": true` folder split is not implemented on this path.
|
|
12
|
+
- See [migration](docs/migration.md) and [CL++ docs](https://kartzrbx.github.io/CLPP/).
|
|
8
13
|
|
|
9
|
-
## 0.2.
|
|
14
|
+
## 0.2.3
|
|
10
15
|
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
- C++ IntelliSense is **clangd** only. The old tokenizer/`completeAt` engine is gone. Tree-sitter is the compiler frontend. `cluaupp lsp` publishes subset parse errors only.
|
|
17
|
-
- `SystemUnderstander` scans identifiers, scores Roblox intents, and stamps Controller / Manager / utility plus `GetService` injections. Filename tags still decide Script vs LocalScript vs ModuleScript.
|
|
18
|
-
- Sample game C++ lives in `examples/game/` (`src/server`, `src/client`, `src/shared`). Compiler `src/` is TypeScript only.
|
|
19
|
-
- CLI security: StyLua / luau-analyze via `spawn` without a shell; emitted paths cannot leave the project; `.env*` stays out of git and the npm pack.
|
|
20
|
-
- Docs / GitHub Pages: clangd, SystemUnderstander, one-file-out emit, `examples/game`. Rojo **7.7.0**.
|
|
21
|
-
- Tests cover `out/` tree, types, modules, path safety, and understander roles.
|
|
22
|
-
|
|
23
|
-
## 0.1.5
|
|
24
|
-
|
|
25
|
-
- Default emit is one tagged `.cpp` → one `.server.luau` / `.client.luau`. `"architecture": true` keeps the old ForeverHD service folders.
|
|
26
|
-
- `--!strict` is opt-in: `#pragma strict`, `#pragma nstrict`, or `"strict": true` in config (default `false`).
|
|
27
|
-
- `.h` / `.hpp` emit type ModuleScripts (`export type` + typed table). A sibling `.cpp` becomes `*Impl.luau`; the header binds those functions.
|
|
28
|
-
- Shared `#include` modules `require` game-rooted paths (`ReplicatedStorage.Cluaupp...` / `ServerScriptService.Cluaupp...`).
|
|
29
|
-
|
|
30
|
-
## 0.1.4
|
|
31
|
-
|
|
32
|
-
- Quoted `#include "Header.h"` of project files becomes `const Header = require(...)`. Header-only structs emit a constructor (`TemplateData()`); const headers bind `PLAYER_DATA_VERSION` from the module. Boot scripts require services (`LeaderstatsServer:init()`).
|
|
33
|
-
- Keep `const` for injected `require` / `GetService` and `const function` for C++ functions (not `local`).
|
|
34
|
-
- `init.meta.json` stays pure JSON. Library `require` injection no longer prepends Luau onto Rojo meta files (which made `rojo serve` fail with a JSONC parse error).
|
|
35
|
-
- Server services emit `init.server.luau` + `init.meta.json` with **only** `RunContext.Server`. Rojo forbids `className` when an `init.*` script exists (the folder is already a Script, not a Folder). `init.luau` is pruned so the instance is not a ModuleScript.
|
|
36
|
-
|
|
37
|
-
## 0.1.3
|
|
38
|
-
|
|
39
|
-
- Architecture: generated services keep a fixed declaration order (requires, types, constants, variables, functions, cleanup, return) without section banners. Domain `Stop` runs `janitor:Cleanup()`.
|
|
40
|
-
- IntelliSense: `cluaupp init` / `cluaupp intellisense` install Microsoft `ms-vscode.cpptools` (VSIX on Cursor, where the marketplace omits it), write `.vscode/c_cpp_properties.json` (LLVM clang++, C++20, `include/` + `src/`, `compile_commands.json`), and disable clangd so the two engines do not fight. `build`/`watch` only refresh `compile_commands.json`.
|
|
41
|
-
- `Class::method` on game types becomes `Class:method()` (`self`). Datatype/library statics stay dotted (`CFrame.lookAt`, `Color3.fromRGB`, `FormatNumber.Abbreviate`).
|
|
42
|
-
- `switch` / `case` / `default` / `break` compile to a one-shot `repeat` with `if` / `elseif` / `else`. The discriminant is evaluated once; stacked `case` labels share a body; `break` leaves the switch even from inside an `if`.
|
|
43
|
-
- Janitor typed border re-exports `_impl` (`export type Janitor = Impl.Janitor; return Impl`). It no longer invents `Has` or requires Promise for a parallel type that did not match howmanysmall.
|
|
44
|
-
- Emit: injected `require` / `GetService` are `const`. C++ functions emit as `const function` instead of `local function`.
|
|
45
|
-
- `.server.cpp` emits `init.luau` + `init.meta.json` with `RunContext.Server`. `init.server.luau` is Legacy and is pruned.
|
|
46
|
-
- `cout << ... << endl` emits `print(...)`. `cerr <<` emits `warn`. `cout::print` / `cout::warn` / `cout::error` / `cout::ping` map to the Roblox globals.
|
|
47
|
-
- Docs: [print and cout](docs/print-cout.md); [Libraries](docs/libraries/index.md) how-tos (DataService Init, Janitor, Promise, Net); [OOP structure](docs/oop/index.md) (file tags, services, modules); [Examples](docs/examples/index.md) (leaderstats, combat validation, shop, HUD, sword). GitHub Pages Learn tabs: OOP, Libraries, print/cout, Examples — generated into `site/` (`guide/oop.html`, `guide/examples.html`).
|
|
48
|
-
|
|
49
|
-
## 0.1.2
|
|
50
|
-
|
|
51
|
-
- Watch does not write `out/` while any file fails to compile (Studio keeps the last good scripts).
|
|
52
|
-
- Watch/build skip rewriting Luau whose contents did not change (a space in C++ no longer floods Rojo).
|
|
53
|
-
- Watch never copies `libs/` or headers. Changing a constant no longer makes Rojo 7 crash on `libs/ArrayIndexer`.
|
|
54
|
-
- `libs/` on `cluaupp build` is fill-only: missing files are restored, existing files are never overwritten or deleted.
|
|
55
|
-
- Filename tags: `.server.cpp` → Script (`init.server.luau`), `.client.cpp` → LocalScript (`init.client.luau`), `.plugin.cpp` → Plugin, `.legacy` / `.legacy.client` / `.legacy.server` → Legacy. Bare `init.luau` is not used for `.server` (Rojo would make a ModuleScript).
|
|
56
|
-
- Dropped `$optional` from `default.project.json` (Rojo 7.7 failed to deserialize it).
|
|
57
|
-
|
|
58
|
-
## 0.1.1
|
|
59
|
-
|
|
60
|
-
- DataService: `DataServiceOptions<T>.Template` is the required player-data table (`T` matches the save struct). Also documents `Exclude`.
|
|
61
|
-
- Compiler: C++ designated initializers (`Type { .Field = value }`) emit Luau tables, so `DataService.Server:Init({ Template = ... })` type-checks and compiles.
|
|
62
|
-
- Watch/build: delete orphaned `out/` files when a source is removed. Never wipe `out/` or `libs/` as a whole — Rojo 7 crashes if `libs/ArrayIndexer` disappears mid-serve. Vendor files are only created if missing; existing `libs/` is never overwritten on watch/build. Watch skips writing `out/` when compile fails, and skips rewriting Luau whose contents did not change.
|
|
63
|
-
|
|
64
|
-
## 0.1.0
|
|
65
|
-
|
|
66
|
-
- Product name: **Cluaupp** (C++ × Luau)
|
|
67
|
-
- First public release
|
|
68
|
-
- CLI: `init`, `build`, `watch`, `--version`
|
|
69
|
-
- Transpile C++ subset → Luau `--!strict`
|
|
70
|
-
- `local` and `const x = ...`
|
|
71
|
-
- Full Roblox API from the official dump (925 classes, 636 enums)
|
|
72
|
-
- Datatypes: Vector3, Vector2, CFrame, UDim, UDim2, Color3, BrickColor, Rect, Ray, …
|
|
73
|
-
- `Enum::Material::Plastic` → `Enum.Material.Plastic`
|
|
74
|
-
- GitHub Pages site for every class, method, and event
|
|
75
|
-
- Game template + IntelliSense header (`roblox.hpp`, `compile_flags.txt`, clangd)
|
|
76
|
-
- IntelliSense headers are valid C++: `LuaArray` for `GetPlayers`, templated `Connect`, optional dump defaults (`FindFirstChild`), no recursive `Vector3.Unit` field
|
|
77
|
-
- Libraries: full GitHub systems in CluauppLibs (Janitor, Promise, Fusion, Iris, Cmdr, TopbarPlus, Chrono, DataServiceV2, EzVisualz, StateMachine, Spring, Display, Module3D, FormatNumber) plus Cluaupp originals (Net, MathUtils, Twinkle, StickyBillboard, VfxUtil)
|
|
78
|
-
- Wally is optional; `node scripts/vendor-libs.js` re-copies from `vendor/` clones
|
|
79
|
-
- Moonwave docs (C++ types, const, safety, organization)
|
|
80
|
-
- Service architecture: filename tags (`.server` / `.client` / `.legacy.*` / module) plus AST intent scoring (combat, cache, players, …) — not leaderstats-only
|
|
81
|
-
- Type functions ArrayIndexer (`Table`) and Occlude (`Keys`) in CluauppLibs
|
|
16
|
+
- Parser accepts `(void)x`, `static_cast<T>(x)`, `static constexpr` fields, and lambdas (`[](Player* p) { ... }`, `[&]`, `[=]`) so `Connect` / `BindToClose` compile without named-function wrappers.
|
|
17
|
+
- Parser keeps `LuaArray<T>` / `vector<T>` field types on structs (`HotBar` / `Storage` on a Template).
|
|
18
|
+
- `string_concat(...)` joins to Luau `..` (alongside string `+`).
|
|
19
|
+
- Cursor is not a licensed host for Microsoft `ms-vscode.cpptools`. Cluaupp no longer writes `C_Cpp.*` settings or `c_cpp_properties.json`; `watch` strips leftover keys and marks cpptools as unwanted. C++ completion stays clangd.
|
|
20
|
+
- Docs site is a C++-class handbook (syntax through lambdas and Luau `--!strict`). Per-class and per-enum dump pages are gone; engine members stay on create.roblox.com.
|
package/README.md
CHANGED
|
@@ -4,117 +4,71 @@
|
|
|
4
4
|
<img src="site/assets/logo.png" alt="Cluaupp" width="160">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**CL++ games on Roblox.** You write [CL++](https://kartzrbx.github.io/CLPP/). Cluaupp runs `clpp`, wires Rojo, and copies CluauppLibs.
|
|
8
8
|
|
|
9
|
-
[
|
|
9
|
+
[CL++ language](https://kartzrbx.github.io/CLPP/) · [Docs](https://kartzrbx.github.io/Cluaupp/) · [Handbook](https://kartzrbx.github.io/Cluaupp/docs/)
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/cluaupp)
|
|
12
12
|
[](https://nodejs.org)
|
|
13
|
-
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
Cluaupp is the **toolchain**, not the language compiler. [KartzRbx/CLPP](https://github.com/KartzRbx/CLPP) owns syntax, IntelliSense (`clpp install`), and Luau codegen. This CLI finds `.clpp` / `.clp` / `.clh`, runs `clpp api compile`, rewrites `ClppLibs` → `ReplicatedStorage.CluauppLibs`, and writes `out/` for Rojo.
|
|
16
|
+
|
|
17
|
+
```clpp
|
|
18
|
+
#include <clpp/roblox.clh>
|
|
19
|
+
#include <clpp/libs/janitor.clh>
|
|
20
|
+
|
|
21
|
+
void init() {
|
|
22
|
+
Players* players = GetService<Players>();
|
|
23
|
+
players::PlayerAdded~>Connect(func [](Player* player) {
|
|
24
|
+
guard (player != null) else {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
post("hello, " .: player.Name);
|
|
28
|
+
});
|
|
23
29
|
}
|
|
24
|
-
players->PlayerAdded.Connect(CreateLeaderstats);
|
|
25
|
-
|
|
26
|
-
auto* part = new Part(workspace);
|
|
27
|
-
part->Size = Vector3(8, 1, 8);
|
|
28
|
-
part->CFrame = CFrame::lookAt(Vector3(0, 10, 0), Vector3(0, 10, -10));
|
|
29
|
-
frame->Size = UDim2::fromScale(1, 1);
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
becomes
|
|
33
|
-
|
|
34
|
-
```luau
|
|
35
|
-
--!strict
|
|
36
|
-
local players: Players = game:GetService("Players")
|
|
37
|
-
for _, player in players:GetPlayers() do
|
|
38
|
-
CreateLeaderstats(player)
|
|
39
|
-
end
|
|
40
|
-
players.PlayerAdded:Connect(CreateLeaderstats)
|
|
41
30
|
```
|
|
42
31
|
|
|
43
32
|
## Install
|
|
44
33
|
|
|
45
|
-
Node.js
|
|
34
|
+
1. [Node.js](https://nodejs.org/) 18+
|
|
35
|
+
2. [Rojo](https://rojo.space/) **7.7.0**
|
|
36
|
+
3. **`clpp` on PATH** from [CL++](https://github.com/KartzRbx/CLPP) (`cargo install --path .`)
|
|
46
37
|
|
|
47
38
|
```bash
|
|
48
39
|
npm install -g cluaupp
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Or run without a global install:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
40
|
+
clpp install
|
|
54
41
|
npx cluaupp init my-game
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Quick start
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
cluaupp init my-game
|
|
61
42
|
cd my-game
|
|
62
43
|
rokit install
|
|
63
44
|
cluaupp build
|
|
64
45
|
rojo serve
|
|
65
46
|
```
|
|
66
47
|
|
|
67
|
-
|
|
48
|
+
| Source | Output | Rojo |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `*.server.clpp` | `*.server.luau` | Script |
|
|
51
|
+
| `*.client.clpp` | `*.client.luau` | LocalScript |
|
|
52
|
+
| `*.clp` / untagged `.clpp` | `*.luau` | ModuleScript |
|
|
53
|
+
| `*.clh` | `*.luau` | ModuleScript |
|
|
68
54
|
|
|
69
|
-
|
|
55
|
+
## CLI
|
|
70
56
|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
```bash
|
|
58
|
+
cluaupp init [folder]
|
|
59
|
+
cluaupp build [folder]
|
|
60
|
+
cluaupp watch [folder]
|
|
61
|
+
cluaupp language # clpp api manifest
|
|
62
|
+
cluaupp intellisense # files.associations + clpp install
|
|
75
63
|
```
|
|
76
64
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
| --- | --- |
|
|
85
|
-
| [Getting started](docs/getting-started.md) | Install, first project, Rojo, IntelliSense |
|
|
86
|
-
| [**Docs + API (GitHub Pages)**](https://kartzrbx.github.io/Cluaupp/) | Site, Learn tab, every class / datatype / enum |
|
|
87
|
-
| [Learn](https://kartzrbx.github.io/Cluaupp/learn/) | C++ subset, Luau output, safety, architecture |
|
|
88
|
-
| [CLI](docs/cli.md) | `init`, `build`, `watch`, flags |
|
|
89
|
-
| [Syntax](docs/syntax.md) | C++ subset → Luau (`local`, `const`, types) |
|
|
90
|
-
| [print and cout](docs/print-cout.md) | `cout <<`, `cout::warn`, `endl` |
|
|
91
|
-
| [Roblox API](docs/roblox-api.md) | Vector3, CFrame, UDim2, GetService, Instance.new |
|
|
92
|
-
| [Architecture](docs/architecture.md) | One file in, one file out; opt-in ForeverHD folders |
|
|
93
|
-
| [OOP structure](docs/oop/index.md) | File tags, services, modules, structs |
|
|
94
|
-
| [Libraries](docs/libraries/index.md) | DataService Init, Janitor, Promise, Net |
|
|
95
|
-
| [Examples](docs/examples/index.md) | Leaderstats, combat validation, shop, HUD, sword |
|
|
96
|
-
| [C++ types](docs/cpp-types.md) | Typing, `const`, safety, organization |
|
|
97
|
-
| [Comparison](docs/comparison.md) | vs roblox-ts and WASM toolchains |
|
|
98
|
-
| [Contributing](CONTRIBUTING.md) | Tests, layout, how to ship |
|
|
99
|
-
|
|
100
|
-
## Programmatic API
|
|
101
|
-
|
|
102
|
-
```js
|
|
103
|
-
const { compileSource, compileService } = require("cluaupp");
|
|
104
|
-
|
|
105
|
-
const luau = compileSource(
|
|
106
|
-
`void init() { print("ok"); }`,
|
|
107
|
-
"init.cpp",
|
|
108
|
-
{ strict: true },
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const service = compileService(
|
|
112
|
-
cppSource,
|
|
113
|
-
"server/leaderstats.server.cpp",
|
|
114
|
-
{ relativeName: "server/leaderstats.server.cpp" },
|
|
115
|
-
);
|
|
116
|
-
// service.files → LeaderStats/Main.luau, PlayersManager, CacheController, Types
|
|
117
|
-
```
|
|
65
|
+
`clpp` missing? Set `CLPP_PATH` or install [CL++](https://github.com/KartzRbx/CLPP).
|
|
66
|
+
|
|
67
|
+
## Language
|
|
68
|
+
|
|
69
|
+
Course and reference: **[kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/)**.
|
|
70
|
+
|
|
71
|
+
Exclusive CL++ (`guard`, `match`, `signal`, `observable`, `.:`, `::`, `~>`, Fusion) is compiled by `clpp`. Samples: [`examples/game`](examples/game). Old C++ games: [docs/migration.md](docs/migration.md).
|
|
118
72
|
|
|
119
73
|
## License
|
|
120
74
|
|
package/docs/README.md
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
# Cluaupp documentation
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
The live handbook is **[GitHub Pages](https://kartzrbx.github.io/Cluaupp/docs/)**. Language course: **[CL++](https://kartzrbx.github.io/CLPP/)**.
|
|
4
|
+
|
|
5
|
+
## Start
|
|
6
|
+
|
|
7
|
+
1. [Intro](intro.md)
|
|
8
|
+
2. [Getting started](getting-started.md)
|
|
9
|
+
3. [CLI](cli.md)
|
|
10
|
+
4. [Config](config.md)
|
|
11
|
+
5. [IntelliSense](intellisense.md) — `clpp install`
|
|
12
|
+
6. [Migration](migration.md) — `.cpp` → `.clpp`
|
|
13
|
+
|
|
14
|
+
## Language
|
|
15
|
+
|
|
16
|
+
Syntax lives in CL++. Cluaupp [syntax](syntax.md) is a short map of operators and file tags.
|
|
17
|
+
|
|
18
|
+
## Structure
|
|
19
|
+
|
|
20
|
+
- [Architecture](architecture.md) — one file in, one file out
|
|
21
|
+
- [OOP / file tags](oop/file-tags.md)
|
|
22
|
+
|
|
23
|
+
## Roblox
|
|
24
|
+
|
|
25
|
+
- [Libraries](libraries/index.md)
|
|
26
|
+
- [Examples](examples/index.md)
|
|
27
|
+
- [Comparison](comparison.md)
|
package/docs/architecture.md
CHANGED
|
@@ -5,88 +5,25 @@ sidebar_position: 15
|
|
|
5
5
|
|
|
6
6
|
# One file in, one file out
|
|
7
7
|
|
|
8
|
-
roblox-ts decides **what instance you get** from a filename **key
|
|
8
|
+
roblox-ts decides **what instance you get** from a filename **key**. Cluaupp does the same for **CL++**.
|
|
9
9
|
|
|
10
10
|
| Key | Rojo instance | Default output |
|
|
11
11
|
| --- | --- | --- |
|
|
12
|
-
| `*.server.
|
|
13
|
-
| `*.client.
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
`DataBoot.client.cpp` becomes `out/client/boot/DataBoot.client.luau` with your `init()` at the end. Shared `#include` modules use `require(ReplicatedStorage.Cluaupp...)`.
|
|
18
|
-
|
|
19
|
-
`--!strict` is opt-in: put `#pragma strict` in the `.cpp`, or set `"strict": true` in `cluaupp.config.json`.
|
|
20
|
-
|
|
21
|
-
The ForeverHD-style folder split (`LeaderStats/Main.luau`, …) is **opt-in**: `"architecture": true`.
|
|
22
|
-
|
|
23
|
-
## SystemUnderstander
|
|
24
|
-
|
|
25
|
-
Like [roblox-ts](https://github.com/roblox-ts/roblox-ts) (filename **key** first) and [roblox-cs](https://github.com/roblox-csharp/roblox-cs) (scan the AST, then decide), Cluaupp does **not** call a generative model. `src/system-understander.ts` walks the Tree-sitter tree, scores token density against Roblox engine services, and returns a report the emitter may stamp as comments / extra `GetService` lines.
|
|
26
|
-
|
|
27
|
-
| Step | What happens |
|
|
28
|
-
| --- | --- |
|
|
29
|
-
| `parseFileTag` | `.server.cpp` → Script / Server, `.client.cpp` → LocalScript / Client, no tag → ModuleScript |
|
|
30
|
-
| `namesIn` | identifiers, `GetService<T>`, `new Class`, string literals |
|
|
31
|
-
| `scoreIntents` | evidence count × side weight (server tokens count more on `.server.cpp`) |
|
|
32
|
-
| `determineArchitecture` | score < 2 → utility Module; otherwise Knit-style Controller / Manager / Service. `players` / `cache` stay supporting if combat, UI, or net already has ≥ 2 tokens |
|
|
33
|
-
|
|
34
|
-
The **Rojo class never changes** because of a role. A HUD LocalScript can be classified as `ViewController` and still emit `hud.client.luau`. Sample sources: [examples/game](../examples/game).
|
|
35
|
-
|
|
36
|
-
## Compiler pipeline
|
|
37
|
-
|
|
38
|
-
Cluaupp does not rewrite C++ as text. The CLI parses a Tree-sitter CST, collects symbols (`GetService<T>()`, `#include`, types, constants), then emits Luau in a fixed order:
|
|
39
|
-
|
|
40
|
-
1. `game:GetService(...)`
|
|
41
|
-
2. `require(...)` (Rojo `default.project.json` when present)
|
|
42
|
-
3. types
|
|
43
|
-
4. constants
|
|
44
|
-
5. functions / script body
|
|
45
|
-
|
|
46
|
-
Formatting is delegated to StyLua; type sanity to `luau-analyze`. See [CLI](cli.md).
|
|
47
|
-
|
|
48
|
-
## File tags
|
|
49
|
-
|
|
50
|
-
| Source | Meaning | Output |
|
|
51
|
-
| --- | --- | --- |
|
|
52
|
-
| `combat.server.cpp` | **Script** | `combat.server.luau` |
|
|
53
|
-
| `hud.client.cpp` | **LocalScript** | `hud.client.luau` |
|
|
54
|
-
| `tools.plugin.cpp` | **Script** RunContext Plugin | `tools.luau` (legacy plugin tag) |
|
|
55
|
-
| `boot.legacy.server.cpp` | Legacy Script | `boot.server.luau` |
|
|
56
|
-
| `damage.cpp` (no tag) | **ModuleScript** | `Damage.luau` |
|
|
57
|
-
|
|
58
|
-
## What a tagged file becomes
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
src/server/leaderstats.server.cpp → out/server/leaderstats.server.luau
|
|
62
|
-
src/client/boot/DataBoot.client.cpp → out/client/boot/DataBoot.client.luau
|
|
63
|
-
src/shared/damage.cpp → out/shared/Damage.luau
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Scripts and LocalScripts keep your functions and call `init()` at the end. ModuleScripts return a table. There is no invented Main, Controller, or Types file.
|
|
67
|
-
|
|
68
|
-
## Opt-in: ForeverHD folders (`"architecture": true`)
|
|
69
|
-
|
|
70
|
-
Set `"architecture": true` in `cluaupp.config.json` to restore the old planner: PascalCase service folders, `Main` / Managers / Controllers / Types, and `require(script.Main):Start()`. Server folders emit `init.server.luau` plus a **pure JSON** `init.meta.json` with only `RunContext.Server` — never `className`, and never library `require` lines (Rojo 7.7 rejects both).
|
|
12
|
+
| `*.server.clpp` | Script | `*.server.luau` |
|
|
13
|
+
| `*.client.clpp` | LocalScript | `*.client.luau` |
|
|
14
|
+
| `*.plugin.clpp` | Plugin Script | `*.plugin.luau` |
|
|
15
|
+
| `.clp` / untagged `.clpp` | ModuleScript | `Name.luau` |
|
|
16
|
+
| `.clh` | ModuleScript | `Name.luau` |
|
|
71
17
|
|
|
72
18
|
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
19
|
+
src/server/leaderstats.server.clpp → out/server/leaderstats.server.luau
|
|
20
|
+
src/client/hud.client.clpp → out/client/hud.client.luau
|
|
21
|
+
src/shared/config.clp → out/shared/config.luau
|
|
22
|
+
src/shared/PlayerData.clh → out/shared/PlayerData.luau
|
|
77
23
|
```
|
|
78
24
|
|
|
79
|
-
|
|
80
|
-
| --- | --- |
|
|
81
|
-
| `PlayerAdded`, `GetPlayers` | `PlayersManager` (Janitor) |
|
|
82
|
-
| `Folder` + `IntValue` / `StringValue` | `CacheController` |
|
|
83
|
-
| `TakeDamage`, `Humanoid`, `Raycast` | `CombatController` (your functions) |
|
|
84
|
-
| `UserInputService`, `InputBegan` | `InputController` |
|
|
85
|
-
| `RemoteEvent`, `Net` | `NetController` |
|
|
86
|
-
| `DataStore`, `DataService` | `DataController` |
|
|
87
|
-
| Domain shapes / stats | `{Service}Types` (`export type`, `return {}`) |
|
|
88
|
-
| Wiring | `Main.Start` / `Main.Stop` |
|
|
25
|
+
`"architecture": true` (ForeverHD `Main` / Managers folders) is **not** generated in Cluaupp 1.0. `clpp` compiles each file; this CLI maps libraries and writes `out/`.
|
|
89
26
|
|
|
90
|
-
|
|
27
|
+
`--!strict` is opt-in: `#pragma strict` or `"strict": true` in `cluaupp.config.json`.
|
|
91
28
|
|
|
92
|
-
|
|
29
|
+
Language: [kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/). File tags: [OOP](oop/file-tags.md).
|
package/docs/cli.md
CHANGED
|
@@ -4,88 +4,36 @@
|
|
|
4
4
|
cluaupp <command> [folder]
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
The compiler is a **collector-emitter** pipeline: Tree-sitter walks the C++ CST, Rojo maps `#include` to `require`, Luau is emitted in a fixed block order (Services → Requires → Types → Constants → Code), then StyLua / `luau-analyze` can run as post-process.
|
|
7
|
+
Cluaupp orchestrates **CL++ → Luau**. It does not parse the language. `clpp` (on PATH) compiles each `.clpp` / `.clp` / `.clh`; Cluaupp post-processes and writes `out/`.
|
|
10
8
|
|
|
11
9
|
## `cluaupp init [folder]`
|
|
12
10
|
|
|
13
|
-
Creates a
|
|
14
|
-
|
|
15
|
-
- `src/server`, `src/client`, `src/shared`
|
|
16
|
-
- `cluaupp.config.json`
|
|
17
|
-
- `default.project.json` (Rojo)
|
|
18
|
-
- `rokit.toml` (Rojo 7.7.0)
|
|
19
|
-
- `include/cluaupp/roblox.hpp` (IntelliSense)
|
|
20
|
-
- `.vscode/` (clangd)
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
cluaupp init .
|
|
24
|
-
cluaupp init my-game
|
|
25
|
-
```
|
|
11
|
+
Creates `src/server`, `src/client`, `src/shared`, Rojo, `rokit.toml`, and a CL++ scaffold. Then run `clpp install` for editor IntelliSense.
|
|
26
12
|
|
|
27
13
|
## `cluaupp build [folder]`
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- `--!strict` only with `#pragma strict`, `"strict": true`, or `--strict` on the single-file path
|
|
32
|
-
- `#include "file.h"` becomes `require(...)` resolved from `default.project.json` when present
|
|
33
|
-
- `#include <cluaupp/roblox.hpp>` is ignored
|
|
34
|
-
- `.h` / `.hpp` emit a type ModuleScript (`export type` + typed table). A sibling `.cpp` becomes `*Impl.luau` (the construction); the header binds those functions.
|
|
35
|
-
- A parse error exits with code 1 and `file:line:column`
|
|
36
|
-
- After emit, **orphans in `out/` are removed** (source deleted → matching Luau deleted). `out/` itself is never wiped, so a running Rojo serve keeps the live tree.
|
|
37
|
-
- `libs/` and `include/cluaupp` are synced by writing missing/changed files only. They are **never** deleted as a folder — Rojo 7 unwrap-crashes if `libs/ArrayIndexer` vanishes while serving.
|
|
15
|
+
Compiles `src/**/*.{clpp,clp,clh}` into `out/`. One tagged file becomes one Luau instance.
|
|
38
16
|
|
|
39
17
|
```bash
|
|
40
18
|
cluaupp build
|
|
41
|
-
cluaupp build ./my-game
|
|
42
19
|
cluaupp build --format --analyze
|
|
20
|
+
cluaupp build --input ./src/server/boot.server.clpp --output ./out/boot.server.luau
|
|
43
21
|
```
|
|
44
22
|
|
|
45
|
-
|
|
23
|
+
`--format` runs StyLua; `--analyze` runs `luau-analyze`.
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
cluaupp build --input ./src/server/boot.server.cpp --output ./out/boot.server.luau --rojo ./default.project.json
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
`--format` runs StyLua; `--analyze` runs `luau-analyze`. On the single-file path both run by default (warnings if the binaries are missing). On a project build they are opt-in.
|
|
25
|
+
If `clpp` is missing: install [CL++](https://github.com/KartzRbx/CLPP) or set `CLPP_PATH`.
|
|
52
26
|
|
|
53
27
|
## `cluaupp watch [folder]`
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## `cluaupp lsp [folder]`
|
|
29
|
+
Rebuilds on save. Does not write `out/` while compile fails.
|
|
58
30
|
|
|
59
|
-
|
|
31
|
+
## `cluaupp language`
|
|
60
32
|
|
|
61
|
-
|
|
33
|
+
Prints `clpp api manifest` (extensions, tags, operators).
|
|
62
34
|
|
|
63
|
-
|
|
35
|
+
## `cluaupp intellisense` / `cluaupp lsp`
|
|
64
36
|
|
|
65
|
-
|
|
37
|
+
Delegates to CL++ (`clpp install`). Cluaupp only writes `files.associations` for `clpp`.
|
|
66
38
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## `cluaupp --help`
|
|
70
|
-
|
|
71
|
-
Shows usage.
|
|
72
|
-
|
|
73
|
-
## Suggested npm scripts
|
|
74
|
-
|
|
75
|
-
```json
|
|
76
|
-
{
|
|
77
|
-
"scripts": {
|
|
78
|
-
"build": "cluaupp build",
|
|
79
|
-
"watch": "cluaupp watch"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
In the Cluaupp development repo:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npm run build:cli # compile the TypeScript CLI
|
|
88
|
-
npm test
|
|
89
|
-
npm run dev # local gitignored playground in game/ + Rojo
|
|
90
|
-
npm run stop # stop Rojo
|
|
91
|
-
```
|
|
39
|
+
## `cluaupp --version` / `--help`
|
package/docs/comparison.md
CHANGED
|
@@ -2,36 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## vs roblox-ts
|
|
4
4
|
|
|
5
|
-
[roblox-ts](https://roblox-ts.com/) transpiles TypeScript → Luau. Cluaupp
|
|
5
|
+
[roblox-ts](https://roblox-ts.com/) transpiles TypeScript → Luau. Cluaupp does the same job for **[CL++](https://kartzrbx.github.io/CLPP/)**: one familiar syntax, readable Luau, Roblox APIs as in Studio.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`*.server.clpp` → Script, `*.client.clpp` → LocalScript, untagged → ModuleScript.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## vs C++ → WASM
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## vs C++ → WASM → Luau (RBX-CPP / Emscripten)
|
|
14
|
-
|
|
15
|
-
Compiling real C++ to WASM and translating the binary to Luau works, but the cost shows up in the API:
|
|
16
|
-
|
|
17
|
-
- Roblox methods become generic calls (`lua_call`, blobs)
|
|
18
|
-
- `GetPlayers()` and `FindFirstChild()` do not come out as they do in Studio
|
|
19
|
-
- Heavy toolchain: Emscripten, CMake, Python, tens of GB of cache
|
|
20
|
-
|
|
21
|
-
Cluaupp skips that path. You write *script* C++ (the same mental subset as roblox-ts) and the compiler emits readable Luau.
|
|
22
|
-
|
|
23
|
-
```cpp
|
|
24
|
-
players->GetPlayers()
|
|
25
|
-
player->FindFirstChild("leaderstats")
|
|
26
|
-
GetService<Players>()
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
is exactly what Studio expects, not a parallel runtime.
|
|
11
|
+
Cluaupp never compiles native C++ or WASM. The language compiler is `clpp` (Rust). This package is init / Rojo / CluauppLibs.
|
|
30
12
|
|
|
31
13
|
## When to use what
|
|
32
14
|
|
|
33
15
|
| Goal | Tool |
|
|
34
16
|
| --- | --- |
|
|
35
17
|
| Game in TypeScript | roblox-ts |
|
|
36
|
-
| Game in
|
|
37
|
-
|
|
|
18
|
+
| Game in CL++ | **Cluaupp** + [`clpp`](https://github.com/KartzRbx/CLPP) |
|
|
19
|
+
| Language reference | [kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/) |
|
package/docs/config.md
CHANGED
|
@@ -13,19 +13,18 @@ File: `cluaupp.config.json` at the game root (next to `src/`).
|
|
|
13
13
|
|
|
14
14
|
| Field | Default | Effect |
|
|
15
15
|
| --- | --- | --- |
|
|
16
|
-
| `rootDir` | `"src"` | Where
|
|
16
|
+
| `rootDir` | `"src"` | Where `.clpp` / `.clp` / `.clh` live |
|
|
17
17
|
| `outDir` | `"out"` | Where Luau is written |
|
|
18
|
-
| `strict` | `false` | Prefix `--!strict`
|
|
19
|
-
| `architecture` | `false` |
|
|
20
|
-
|
|
21
|
-
If the file is missing, those defaults apply.
|
|
18
|
+
| `strict` | `false` | Prefix `--!strict` when `clpp` did not already (overridden by `#pragma`) |
|
|
19
|
+
| `architecture` | `false` | Ignored in 1.0 (always one file in, one file out) |
|
|
22
20
|
|
|
23
21
|
## Rojo
|
|
24
22
|
|
|
25
|
-
The template
|
|
23
|
+
The template maps:
|
|
26
24
|
|
|
27
25
|
- `out/server` → `ServerScriptService.Cluaupp`
|
|
28
26
|
- `out/client` → `StarterPlayer.StarterPlayerScripts.Cluaupp`
|
|
29
27
|
- `out/shared` → `ReplicatedStorage.Cluaupp`
|
|
28
|
+
- `libs` → `ReplicatedStorage.CluauppLibs`
|
|
30
29
|
|
|
31
|
-
`*.server.
|
|
30
|
+
`*.server.clpp` → `*.server.luau` (Script). `*.client.clpp` → LocalScript. `.clp` / `.clh` → ModuleScript.
|
package/docs/cpp-advanced.md
CHANGED
|
@@ -10,15 +10,18 @@ The subset is intentional. What exists is enough for game scripts; what is missi
|
|
|
10
10
|
## Supported
|
|
11
11
|
|
|
12
12
|
- Functions, prototypes (headers only), `if` / `else` / `while` / range-`for` / `switch` (`case`, `default`, `break`)
|
|
13
|
+
- `struct` types + `Class::` methods in a sibling `.h` / `.cpp`
|
|
13
14
|
- `new Class(parent)`, `GetService<T>()`, `::` statics (`CFrame::lookAt`, `Enum::Material::Plastic`)
|
|
15
|
+
- `static_cast<T>(x)`, `(void)x`, lambdas in `Connect` / `Add`
|
|
16
|
+
- `static` / `constexpr` / `inline` specifiers, `LuaArray<T>`, `string_concat`
|
|
14
17
|
- `->` methods and properties, `.` members, `Connect`
|
|
15
|
-
- `const`, `auto`, `nullptr`, arithmetic, `&&` `||`
|
|
18
|
+
- `const`, `auto`, `nullptr`, arithmetic, `&&` `||` `!=`, string `+`
|
|
16
19
|
- Quoted includes, `.h` / `.hpp` as sources
|
|
17
20
|
- Libraries via `#include <cluaupp/libs/...>` → `require(CluauppLibs.*)`
|
|
18
21
|
|
|
19
22
|
## Not supported (yet)
|
|
20
23
|
|
|
21
|
-
Full C++: templates besides `GetService<T
|
|
24
|
+
Full C++: templates besides `GetService<T>` / `static_cast` / `LuaArray`, `class` bodies as emitted metatables, `std::`, overloading as two runtimes, C-style `for`, macros, pointer arithmetic, JSX.
|
|
22
25
|
|
|
23
26
|
If you need a custom type, it is usually a **ModuleScript in shared** (a `.cpp` of functions) or a Wally package, not a C++ class the compiler would lower to a metatable.
|
|
24
27
|
|
|
@@ -72,4 +75,4 @@ void Grant(Player* player, int amount) {
|
|
|
72
75
|
5. **Headers declare, scripts define.** Prototypes in `.h`, bodies in `.cpp`.
|
|
73
76
|
6. **Do not share mutable statics across server and client** — use Net or DataService.
|
|
74
77
|
|
|
75
|
-
See also: [syntax](syntax.md), [print and cout](print-cout.md), [libraries](libraries/index.md), [OOP](oop/index.md), [examples](examples/index.md), [comparison](comparison.md).
|
|
78
|
+
See also: [syntax](syntax.md) (complete subset), [print and cout](print-cout.md), [libraries](libraries/index.md), [OOP](oop/index.md), [examples](examples/index.md), [comparison](comparison.md). Optimization notes on the site: [Optimization](https://kartzrbx.github.io/Cluaupp/docs/optimization.html).
|
package/docs/cpp-types.md
CHANGED
|
@@ -17,6 +17,8 @@ Cluaupp is statically typed in the C++ you write and in the Luau it emits. A typ
|
|
|
17
17
|
| `void` | (no return) | procedures |
|
|
18
18
|
| `auto` | inferred | when `new` or `GetService` makes the type obvious |
|
|
19
19
|
| `Player*`, `Folder*`, … | `Player`, `Folder` | Instances |
|
|
20
|
+
| `LuaArray<int>` / `vector<T>` | `{number}` | arrays (Template inventory, `GetPlayers`) |
|
|
21
|
+
| `optional<T>` | `T?` | missing values (prefer `nullptr` on Instances) |
|
|
20
22
|
| `Vector3`, `CFrame`, `UDim2` | same | datatypes |
|
|
21
23
|
|
|
22
24
|
```cpp
|