objects.getById
Returns one of your objects by its ID, or undefined when there is none.
Renamed in 0.28 from objects.get; see renamed names.
Signature
Section titled “Signature”objects.getById(id: number): ScriptObject | undefinedParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
number |
The ID returned by objects.create. |
Returns
Section titled “Returns”The ScriptObject, or undefined.
Example
Section titled “Example”import { objects, server } from "nativemp";
const objectId = 0; // the ID objects.create returnedconst object = objects.getById(objectId);if (object) server.log(`Model ${object.model} is in interior ${object.interior}`);Related
Section titled “Related”objects.listAll: list your objectsobjects.destroy: remove an object