ScriptModule
ceramic.ScriptModule (Class)
Represents a script module for inter-script communication.
Script modules provide a type-safe way for scripts to access each other's exported functions and variables. When a script calls methods or accesses properties on a ScriptModule, the requests are dynamically resolved to the owning script's scope.
This enables modular script architectures where scripts can interact without direct references to each other.
// In script A:
var health = 100;
function takeDamage(amount) {
health -= amount;
}
// In script B:
var playerModule = module('player');
playerModule.takeDamage(10);
var currentHealth = playerModule.health;
Instance Members
The script that owns this module. All field access and method calls are delegated to this script.
Creates a new module for the given script.
Name | Type | Description |
---|---|---|
owner |
Script | Script that exports this module |