Skip to main content

CradleClient

This item only works when running on the client. Client

This is the API Documentation for the CradleClient module. It contains all the API functions for the client.

local Cradle = require(game:GetService("ReplicatedStorage").Cradle)

Properties​

RemoteComm​

CradleClient.RemoteComm: table

Contains the Remote Communication Module.

tip

See the Networking guide to learn more about it.

Component​

CradleClient.Component: table

Contains the Component Module.

tip

See the Components guide to learn more about it.

Modules​

CradleClient.Modules: table

Contains all modules in the Modules folder.

Shared​

CradleClient.Shared: table

Contains all modules that is stored in the Modules Folder.

Packages​

CradleClient.Packages: table

Contains all modules in the Packages folder.

Util​

deprecated in v1.0.0
</>
This was deprecated in v1.0.0

This item is deprecated. Do not use it for new work.

CradleClient.Util: table

Contains all modules in the Packages folder.

Functions​

CreateController​

This item only works when running on the client. Client
CradleClient:CreateController(Name: string) → Controller

Creates a controller for the client.

caution

Controllers must be created before calling Cradle:Start()

Usage
local SomeController = Cradle:CreateController({
	Name = "SomeController",
})

function SomeController:Init()
	print("SomeController has been initialised!")
end

function SomeController:Start()
	print("SomeController has started!")
end

GetController​

This item only works when running on the client. Client
CradleClient:GetController(controllerName: string) → Controller

Gets a controller by name. Throws a warning if the controller does not exist.

GetService​

CradleClient:GetService(serviceName: string) → Service

Gets a service by name. Throws a warning if the service is not found.

caution

This will only return services that have been exposed to the client with its Client table.

Load​

CradleClient:Load() → nil

Loads all services and components.

caution

This must be called before calling Cradle:Start()

Start​

CradleClient:Start() → nil

Starts all services and components.

caution

This must be called after calling Cradle:Load()

Show raw api
{
    "functions": [
        {
            "name": "CreateController",
            "desc": "Creates a controller for the client.\n\n:::caution\nControllers must be created before calling `Cradle:Start()`\n:::\n\n:::note Usage\n```lua\nlocal SomeController = Cradle:CreateController({\n\tName = \"SomeController\",\n})\n\nfunction SomeController:Init()\n\tprint(\"SomeController has been initialised!\")\nend\n\nfunction SomeController:Start()\n\tprint(\"SomeController has started!\")\nend\n```",
            "params": [
                {
                    "name": "Name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Controller"
                }
            ],
            "function_type": "method",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 150,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "GetController",
            "desc": "Gets a controller by name. Throws a warning if the controller does not exist.",
            "params": [
                {
                    "name": "controllerName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Controller"
                }
            ],
            "function_type": "method",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 172,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "GetService",
            "desc": "Gets a service by name. Throws a warning if the service is not found.\n\n:::caution\nThis will only return services that have been exposed to the client with its Client table.\n:::",
            "params": [
                {
                    "name": "serviceName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Service"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 193,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "CreateComponent",
            "desc": "Creates a new component.",
            "params": [
                {
                    "name": "ModuleScript",
                    "desc": "",
                    "lua_type": "mod"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "nil"
                }
            ],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 212,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Load",
            "desc": "Loads all services and components.\n\n:::caution\nThis must be called before calling `Cradle:Start()`\n:::",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 233,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Start",
            "desc": "Starts all services and components.\n\n:::caution\nThis must be called after calling `Cradle:Load()`\n:::",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "nil"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 269,
                "path": "src/CClientInternal.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "RemoteComm",
            "desc": "Contains the Remote Communication Module.\n\n:::tip\nSee the [Networking](networking) guide to learn more about it.\n:::",
            "lua_type": "table",
            "source": {
                "line": 48,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Component",
            "desc": "Contains the Component Module.\n\n:::tip\nSee the [Components](/docs/components) guide to learn more about it.\n:::",
            "lua_type": "table",
            "source": {
                "line": 59,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Modules",
            "desc": "Contains all modules in the Modules folder.",
            "lua_type": "table",
            "source": {
                "line": 66,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Shared",
            "desc": "Contains all modules that is stored in the Modules Folder.",
            "lua_type": "table",
            "source": {
                "line": 73,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Packages",
            "desc": "Contains all modules in the Packages folder.",
            "lua_type": "table",
            "source": {
                "line": 80,
                "path": "src/CClientInternal.lua"
            }
        },
        {
            "name": "Util",
            "desc": "Contains all modules in the Packages folder.",
            "lua_type": "table",
            "deprecated": {
                "version": "v1.0.0",
                "desc": null
            },
            "source": {
                "line": 88,
                "path": "src/CClientInternal.lua"
            }
        }
    ],
    "types": [],
    "name": "CradleClient",
    "desc": "This is the API Documentation for the CradleClient module. It contains all the API functions for the client.\n\n```lua\nlocal Cradle = require(game:GetService(\"ReplicatedStorage\").Cradle)\n```",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 11,
        "path": "src/CClientInternal.lua"
    }
}