void init()
Script / LocalScript entry point. CL++ has no int main().
Syntax
Section titled “Syntax”void init() { // ...}Parameters
Section titled “Parameters”None.
Return value
Section titled “Return value”void.
Luau emit
Section titled “Luau emit”init() (called at the end of the file)
Description
Section titled “Description”Only Scripts and LocalScripts run init() at the bottom of the emitted file. Untagged .clpp files are ModuleScripts: they return the table of Class:: methods and must not rely on init as a Roblox entry.
Construct one service object in init() and close over it from lambdas — that is the game singleton.
In init(), a synthetic __janitor is created and also game:BindToClose.
Example
Section titled “Example”#include <clpp/roblox.clh>
void init() { Players players = GetService<Players>(); post("ready");}Emits:
local players: Players = game:GetService("Players")print("ready")init()