Game Extension API
Methods added to the Roblox DataModel (game) by the Nodeal runtime.
Game Extension API
Nodeal extends the standard Roblox DataModel (the game global) with methods that drive its Dependency Injection and Environment Extension systems. These methods are available context-wide within the Nodeal runtime.
Registers a singleton object as a "Service." Once registered, this service becomes discoverable via game:GetService() by its registered name.
game:RegisterService(className: string, instance: table | Userdata): void| Name | Type | Description |
|---|---|---|
className | string | The unique identifier for the service. |
instance | table | Userdata | The singleton object to register. Typically a Nodeal module. |
Service Overriding: If you register a service with a name that matches a standard Roblox service (e.g., "Players"), Nodeal will prefer your custom implementation when game:GetService is called. Use this power with caution.
local InventoryService = {}function InventoryService:GetItems(player) return {} endgame:RegisterService("InventoryService", InventoryService)The primary discovery method for Nodeal. It is a drop-in, virtualized replacement for the standard Roblox method.
game:GetService(className: string): anyUnified Discovery: Nodeal's version of GetService checks the custom service registry first. If no custom service is found, it falls back to the native Roblox engine to fetch standard services like RunService or HttpService.
local HttpService = game:GetService("HttpService") -- Native fallbacklocal Inventory = game:GetService("InventoryService") -- Custom Nodeal serviceInjects or overrides a global state across every module in your project. This is how Nodeal provides framework-wide utility libraries.
game:RegisterBuiltIn(builtInName: string, library: table | Userdata): voidUse RegisterBuiltIn to provide common utility libraries like Promise, Signal, or extended Math functions to every script without requiring an import call.
local Logger = { log = print }game:RegisterBuiltIn("Logger", Logger)-- Now in any other module:Logger.log("Built-in works!")Extends the framework by defining custom function decorators. This allows you to implement complex logic—like networking or access control—via simple annotations.
game:RegisterDecorator(tag: string, handler: function): voidThe handler is a wrapper function with the following signature:
handler(self, func, ...metadataArgs) -> (actualFunc)
game:RegisterDecorator("adminOnly", function(_, func, fallbackMessage) return function(...) if isAdmin(game.Players.LocalPlayer) then return func(...) else warn(fallbackMessage or "Access Denied") end endend)