Cells
Find Cells with cell calls. Read and change properties on the returned handle.
cell.get(id)
Find a Cell by ID.
- Arguments
id: numeric Cell ID.- Returns
Cell handle, or
nilif missing.- Works with
Active World Cells.
- Missing values and errors
Wrong argument counts or types report an error.
const object = cell.get(12345)
if object != nil {
debug.log(object.id)
}cell.exists(id)
Check whether a Cell exists.
- Arguments
id: numeric object ID.- Returns
trueif it exists; otherwisefalse.- Works with
Active World Cells.
- Missing values and errors
Wrong argument counts or types report an error.
debug.log(cell.exists(12345))cell.new(type_name)
Create a temporary Cell.
- Arguments
type_name: Block, FxBlock, Player, Light, SpawnPoint, AudioEmitter, or ParticleEmitter string.- Returns
A Cell or Light handle, depending on type.
- Works with
Runtime-created Cells.
- Missing values and errors
An unknown type reports an error. These Cells are discarded when Play stops.
ParticleEmitter Cells [BETA]
ParticleEmitter creates a temporary particle emitter Cell.
const block = cell.new("Block")
block.position = [5, 2, 5]
block.color = [1, 0.5, 0]cell.delete(handle)
Remove a Cell from the active game.
- Arguments
handle: Cell or Light handle.- Returns
nil.- Works with
Authored and runtime-created Cells.
- Missing values and errors
Other handle kinds report an error. Removing an authored Cell during Play is temporary.
const block = cell.new("Block")
cell.delete(block)cell.id
Read the persistent Cell ID.
- Arguments
No call arguments. Read this property.
- Returns
number. Read-only.
- Works with
cell handles.
- Missing values and errors
Assigning to this property is not supported. Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.id)
}cell.name
Read the Cell identity name.
- Arguments
No call arguments. Read this property.
- Returns
string. Read-only.
- Works with
cell handles.
- Missing values and errors
Assigning to this property is not supported. Removed objects and unsupported handle kinds cannot supply this property.
Authored Cell names are read-only during Play. Runtime-created Cells can be renamed.
const block = cell.get(12345)
if block != nil {
debug.log(block.name)
}cell.cellType
Read the Cell type name.
- Arguments
No call arguments. Read this property.
- Returns
string. Read-only.
- Works with
cell handles.
- Missing values and errors
Assigning to this property is not supported. Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.cellType)
}cell.position
Read or change a runtime-created Cell position.
- Arguments
No call arguments. Assign [x, y, z] numbers to change it.
- Returns
[x, y, z] numbers. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Authored Cell position is read-only during Play. Use a runtime-created Cell when your script must move it.
const block = cell.get(12345)
if block != nil {
debug.log(block.position)
}cell.visible
Show or hide the Cell.
- Arguments
No call arguments. Assign bool to change it.
- Returns
bool. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.visible)
}cell.enabled
Enable or disable the Cell or Light.
- Arguments
No call arguments. Assign bool to change it.
- Returns
bool. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.enabled)
}cell.solid
Control Cell collision.
- Arguments
No call arguments. Assign bool to change it.
- Returns
bool. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.solid)
}cell.anchored
Control whether the Cell stays fixed.
- Arguments
No call arguments. Assign bool to change it.
- Returns
bool. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.anchored)
}cell.color
Change the Cell color.
- Arguments
No call arguments. Assign [r, g, b] numbers to change it.
- Returns
[r, g, b] numbers. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.color)
}cell.offset
Change the Cell visual offset.
- Arguments
No call arguments. Assign [x, y, z] numbers to change it.
- Returns
[x, y, z] numbers. Readable and writable.
- Works with
cell handles.
- Missing values and errors
Removed objects and unsupported handle kinds cannot supply this property.
Changes during Play do not rewrite the saved World.
const block = cell.get(12345)
if block != nil {
debug.log(block.offset)
}cell.attributes
Read custom Cell values.
- Arguments
No call arguments. Read this property.
- Returns
map. Read-only.
- Works with
cell handles.
- Missing values and errors
Assigning to this property is not supported. Removed objects and unsupported handle kinds cannot supply this property.
Edit entries with cell.attributes[key] = value. Assigning nil removes the temporary override and restores the authored value.
const block = cell.get(12345)
if block != nil {
debug.log(block.attributes)
}cell.sound
Get an AudioEmitter Cell sound control.
- Arguments
No call arguments. Read this property.
- Returns
Sound handle. Read-only.
- Works with
cell handles.
- Missing values and errors
Assigning to this property is not supported. Removed objects and unsupported handle kinds cannot supply this property.
Only audio-capable Cells provide a useful sound control.
const block = cell.get(12345)
if block != nil {
debug.log(block.sound)
}light.getObject()
Get the object associated with this Cell.
- Arguments
No arguments.
- Returns
An object handle, or nil.
- Works with
Cell and Light handles; enabled controls apply to Lights.
- Missing values and errors
Use a valid handle. Wrong argument counts or types report an error.
const lamp = get_light(0, 2, 0)
if lamp != nil {
debug.log(lamp.getObject())
}light.is_enabled()
Read whether this Light is enabled.
- Arguments
No arguments.
- Returns
A bool for a Light; nil when no Light is resolved.
- Works with
Cell and Light handles; enabled controls apply to Lights.
- Missing values and errors
Use a valid handle. Wrong argument counts or types report an error.
const lamp = get_light(0, 2, 0)
if lamp != nil {
debug.log(lamp.is_enabled())
}light.set_enabled(enabled)
Change whether this Light is enabled.
- Arguments
enabled: bool.- Returns
nil.
- Works with
Cell and Light handles; enabled controls apply to Lights.
- Missing values and errors
Use a valid handle. Wrong argument counts or types report an error.
const lamp = get_light(0, 2, 0)
if lamp != nil {
lamp.set_enabled(true)
}[BETA] marks features newer than the current public release. Current release: 0.8.0.