ledger.set
Replaces a stored value on an element.
Signature
ledger.set(ref: ElementRef, key: string, value: AbiValue): void
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ref | ElementRef | Required | The element it works on, usually self. |
key | string | Required | The name of the stored value. |
value | AbiValue | Required | The value to store. |
Returns
void Nothing.
Example
ledger.set(self, "hp", math.min(max_hp, hp + amount));
