Skip to main content
Docs
›
ledger.set

ledger.set

Ledger

Replaces a stored value on an element.

Signature

ledger.set(ref: ElementRef, key: string, value: AbiValue): void

Parameters

NameTypeRequiredDescription
refElementRefRequiredThe element it works on, usually self.
keystringRequiredThe name of the stored value.
valueAbiValueRequiredThe value to store.

Returns

void Nothing.

Example

ledger.set(self, "hp", math.min(max_hp, hp + amount));