Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 40x 40x 40x 43x 43x 1x 42x | /** * Exports object instance get variable variable value function. * * @module object-instance/variables/get-variable-value.function */ import type { AgtkObjectInstance } from '@agogpixel/pgmmv-ts/api/agtk/object-instance/object-instance'; import { ObjectInstanceAccessorType } from '../object-instance-accessor-type.enum'; import { resolveId } from '../resolve-id.function'; /** * Get variable value in object instance. * * @param objectInstance Object instance. * @param key Variable ID or name. * @returns Resolved variable value or `undefined`. */ export function getVariableValue(objectInstance: AgtkObjectInstance, key: number | string) { const id = resolveId(objectInstance, ObjectInstanceAccessorType.Variables, key); if (id === -1) { return; } return objectInstance.variables.get(id).getValue(); } |